mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Make the Xcode layout not look horrible
This commit is contained in:
38
atom.gyp
38
atom.gyp
@@ -18,7 +18,7 @@
|
||||
],
|
||||
},
|
||||
'includes': [
|
||||
'cef_paths2.gypi',
|
||||
'cef/cef_paths2.gypi',
|
||||
],
|
||||
'target_defaults': {
|
||||
'xcode_settings': {
|
||||
@@ -40,7 +40,7 @@
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
],
|
||||
'include_dirs': [ '.' ],
|
||||
'include_dirs': [ '.', 'cef' ],
|
||||
'sources': [
|
||||
'<@(includes_common)',
|
||||
'<@(includes_wrapper)',
|
||||
@@ -111,19 +111,21 @@
|
||||
# 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',
|
||||
'cef/frameworks/libcef.dylib',
|
||||
'cef/frameworks/ffmpegsumo.so',
|
||||
],
|
||||
},
|
||||
],
|
||||
'postbuilds': [
|
||||
{
|
||||
'postbuild_name': 'Copy Helper App',
|
||||
'action': [
|
||||
'cp',
|
||||
'-r',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom Helper.app',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks',
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Fix Framework Link',
|
||||
'action': [
|
||||
@@ -139,7 +141,7 @@
|
||||
'action': [
|
||||
'cp',
|
||||
'-r',
|
||||
'cef/Resources',
|
||||
'cef/resources',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/'
|
||||
],
|
||||
},
|
||||
@@ -170,9 +172,9 @@
|
||||
'atom/cefclient_mac.h',
|
||||
'atom/cefclient_mac.mm',
|
||||
'atom/client_handler_mac.mm',
|
||||
'include/cef_application_mac.h',
|
||||
'include/internal/cef_mac.h',
|
||||
'include/internal/cef_types_mac.h',
|
||||
'cef/include/cef_application_mac.h',
|
||||
'cef/include/internal/cef_mac.h',
|
||||
'cef/include/internal/cef_types_mac.h',
|
||||
],
|
||||
}],
|
||||
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
|
||||
@@ -199,7 +201,7 @@
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
],
|
||||
'include_dirs': [ '.' ],
|
||||
'include_dirs': [ '.', 'cef' ],
|
||||
'sources': [
|
||||
'<@(includes_common)',
|
||||
'<@(includes_capi)',
|
||||
@@ -208,7 +210,7 @@
|
||||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'cef/libcef.dylib',
|
||||
'cef/frameworks/libcef.dylib',
|
||||
],
|
||||
}
|
||||
},
|
||||
@@ -236,7 +238,7 @@
|
||||
'USING_CEF_SHARED',
|
||||
'PROCESS_HELPER_APP',
|
||||
],
|
||||
'include_dirs': [ '.' ],
|
||||
'include_dirs': [ '.', 'cef' ],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
|
||||
|
||||
172
atom/atom/cefclient.rc
Normal file
172
atom/atom/cefclient.rc
Normal file
@@ -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
|
||||
|
||||
408
atom/atom/cefclient_gtk.cpp
Normal file
408
atom/atom/cefclient_gtk.cpp
Normal file
@@ -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 <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#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<ClientHandler> 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<CefBrowser> 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<CefBrowser> 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<CefBrowser> 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<ClientApp> 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;
|
||||
}
|
||||
12
atom/atom/cefclient_mac.h
Normal file
12
atom/atom/cefclient_mac.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "include/cef_app.h"
|
||||
|
||||
@interface ClientApplication : NSApplication <CefAppProtocol, NSWindowDelegate, NSApplicationDelegate> {
|
||||
@private
|
||||
BOOL handlingSendEvent_;
|
||||
}
|
||||
|
||||
+ (void)populateAppSettings:(CefSettings &)settings;
|
||||
- (void)createWindow;
|
||||
- (void)populateBrowserSettings:(CefBrowserSettings &)settings;
|
||||
|
||||
@end
|
||||
152
atom/atom/cefclient_mac.mm
Normal file
152
atom/atom/cefclient_mac.mm
Normal file
@@ -0,0 +1,152 @@
|
||||
#import "include/cef_application_mac.h"
|
||||
#import "atom/client_handler.h"
|
||||
#import "atom/cefclient_mac.h"
|
||||
|
||||
// The global ClientHandler reference.
|
||||
extern CefRefPtr<ClientHandler> g_handler;
|
||||
|
||||
@implementation ClientApplication
|
||||
|
||||
+ (id)sharedApplication {
|
||||
id atomApp = [super sharedApplication];
|
||||
|
||||
CefSettings settings;
|
||||
[self populateAppSettings:settings];
|
||||
|
||||
CefMainArgs mainArgs(0, NULL);
|
||||
CefRefPtr<CefApp> app;
|
||||
|
||||
CefInitialize(mainArgs, settings, app.get());
|
||||
|
||||
return atomApp;
|
||||
}
|
||||
|
||||
+ (void)populateAppSettings:(CefSettings &)settings {
|
||||
CefString(&settings.cache_path) = "";
|
||||
CefString(&settings.user_agent) = "";
|
||||
CefString(&settings.log_file) = "";
|
||||
CefString(&settings.javascript_flags) = "";
|
||||
|
||||
settings.log_severity = LOGSEVERITY_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Create the application on the UI thread.
|
||||
- (void)createWindow {
|
||||
// Create the main application window.
|
||||
NSRect window_rect = { {0, 0}, {800, 800} };
|
||||
NSWindow* mainWnd = [[UnderlayOpenGLHostingWindow alloc]
|
||||
initWithContentRect:window_rect
|
||||
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask )
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
[mainWnd setTitle:@"cefclient"];
|
||||
[mainWnd setDelegate:self];
|
||||
|
||||
// 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 handler.
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(contentView);
|
||||
|
||||
// Create the browser view.
|
||||
CefWindowInfo window_info;
|
||||
CefBrowserSettings settings;
|
||||
|
||||
[self populateBrowserSettings:settings];
|
||||
|
||||
window_info.SetAsChild(contentView, window_rect.origin.x, window_rect.origin.y, window_rect.size.width, window_rect.size.height);
|
||||
CefBrowserHost::CreateBrowser(window_info, g_handler.get(), g_handler->GetStartupURL(), settings);
|
||||
|
||||
[mainWnd makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)populateBrowserSettings:(CefBrowserSettings &)settings {
|
||||
CefString(&settings.default_encoding) = "UTF-8";
|
||||
settings.remote_fonts_disabled = true;
|
||||
settings.encoding_detector_enabled = false;
|
||||
settings.javascript_disabled = false;
|
||||
settings.javascript_open_windows_disallowed = true;
|
||||
settings.javascript_close_windows_disallowed = false;
|
||||
settings.javascript_access_clipboard_disallowed = false;
|
||||
settings.dom_paste_disabled = true;
|
||||
settings.caret_browsing_enabled = false;
|
||||
settings.java_disabled = true;
|
||||
settings.plugins_disabled = true;
|
||||
settings.universal_access_from_file_urls_allowed = false;
|
||||
settings.file_access_from_file_urls_allowed = false;
|
||||
settings.web_security_disabled = false;
|
||||
settings.xss_auditor_enabled = true;
|
||||
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 = true;
|
||||
settings.tab_to_links_disabled = true;
|
||||
settings.hyperlink_auditing_disabled = true;
|
||||
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_disabled = false;
|
||||
settings.accelerated_layers_disabled = false;
|
||||
settings.accelerated_video_disabled = false;
|
||||
settings.accelerated_2d_canvas_disabled = false;
|
||||
settings.accelerated_painting_enabled = true;
|
||||
settings.accelerated_filters_enabled = true;
|
||||
settings.accelerated_plugins_disabled = false;
|
||||
settings.developer_tools_disabled = false;
|
||||
settings.fullscreen_enabled = true;
|
||||
}
|
||||
|
||||
# pragma mark NSApplicationDelegate
|
||||
|
||||
// Sent by the default notification center immediately before the application terminates.
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification {
|
||||
g_handler = NULL; // Shut down CEF.
|
||||
CefShutdown();
|
||||
[self release];
|
||||
}
|
||||
|
||||
# pragma mark CefAppProtocol
|
||||
|
||||
- (BOOL)isHandlingSendEvent {
|
||||
return handlingSendEvent_;
|
||||
}
|
||||
|
||||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
|
||||
handlingSendEvent_ = handlingSendEvent;
|
||||
}
|
||||
|
||||
- (void)sendEvent:(NSEvent*)event {
|
||||
CefScopedSendingEvent sendingEventScoper;
|
||||
[super sendEvent:event];
|
||||
}
|
||||
|
||||
# pragma mark NSWindowDelegate
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification*)notification {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
g_handler->GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean ourselves up after clearing the stack of anything that might have the window on it.
|
||||
- (BOOL)windowShouldClose:(id)window {
|
||||
[window autorelease];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
546
atom/atom/cefclient_win.cpp
Normal file
546
atom/atom/cefclient_win.cpp
Normal file
@@ -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 <windows.h>
|
||||
#include <commdlg.h>
|
||||
#include <shellapi.h>
|
||||
#include <direct.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#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<ClientHandler> 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<ClientApp> 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<int>(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<CefBrowser> 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<CefBrowser> 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<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
|
||||
SetWindowLongPtr(editWnd, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG_PTR>(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<CefBrowser> 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<CefBrowser> 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;
|
||||
}
|
||||
308
atom/atom/client_handler.cpp
Normal file
308
atom/atom/client_handler.cpp
Normal file
@@ -0,0 +1,308 @@
|
||||
// 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 <sstream>
|
||||
#include "include/cef_path_util.h"
|
||||
#include "include/cef_process_util.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "atom/client_handler.h"
|
||||
|
||||
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<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
|
||||
if (command_line->HasSwitch("url"))
|
||||
m_StartupURL = command_line->GetSwitchValue("url");
|
||||
if (m_StartupURL.empty())
|
||||
m_StartupURL = "http://www.google.com/";
|
||||
|
||||
m_bExternalDevTools = command_line->HasSwitch("external-devtools");
|
||||
}
|
||||
|
||||
ClientHandler::~ClientHandler() {
|
||||
}
|
||||
|
||||
bool ClientHandler::OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnBeforeContextMenu(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model) {
|
||||
|
||||
model->AddItem(MENU_ID_USER_FIRST, "&Show DevTools");
|
||||
CefString devtools_url = browser->GetHost()->GetDevToolsURL(true);
|
||||
|
||||
// Disable the menu option if DevTools isn't enabled or if a window already open for the current URL.
|
||||
if (devtools_url.empty() || m_OpenDevToolsURLs.find(devtools_url) != m_OpenDevToolsURLs.end()) {
|
||||
model->SetEnabled(MENU_ID_USER_FIRST, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientHandler::OnContextMenuCommand(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
EventFlags event_flags) {
|
||||
|
||||
if (command_id == MENU_ID_USER_FIRST) {
|
||||
ShowDevTools(browser);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {
|
||||
REQUIRE_UI_THREAD();
|
||||
}
|
||||
|
||||
bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnBeforeDownload(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) {
|
||||
REQUIRE_UI_THREAD();
|
||||
}
|
||||
|
||||
void ClientHandler::OnDownloadUpdated(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
CefRefPtr<CefDownloadItemCallback> callback) {
|
||||
REQUIRE_UI_THREAD();
|
||||
}
|
||||
|
||||
void ClientHandler::OnRequestGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url,
|
||||
int request_id,
|
||||
CefRefPtr<CefGeolocationCallback> callback) {
|
||||
}
|
||||
|
||||
bool ClientHandler::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event,
|
||||
bool* is_keyboard_shortcut) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> 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<CefBrowser> 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<CefBrowser> browser) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
m_Browser = NULL; // Free the browser pointer so that the browser can be destroyed
|
||||
}
|
||||
else if (browser->IsPopup()) {
|
||||
// Remove the record for DevTools popup windows.
|
||||
std::set<std::string>::iterator it = m_OpenDevToolsURLs.find(browser->GetMainFrame()->GetURL());
|
||||
if (it != m_OpenDevToolsURLs.end())
|
||||
m_OpenDevToolsURLs.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) {
|
||||
REQUIRE_UI_THREAD();
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) {
|
||||
REQUIRE_UI_THREAD();
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (errorCode == ERR_ABORTED) // Don't display an error for downloaded files.
|
||||
return;
|
||||
else if (errorCode == ERR_UNKNOWN_URL_SCHEME) { // Don't display an error for external protocols that we allow the OS to handle. See OnProtocolExecution().
|
||||
return;
|
||||
}
|
||||
else {
|
||||
std::stringstream ss;
|
||||
ss << "<html><body><h2>Failed to load URL " << std::string(failedUrl) <<
|
||||
" with error " << std::string(errorText) << " (" << errorCode <<
|
||||
").</h2></body></html>";
|
||||
frame->LoadString(ss.str(), failedUrl);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {
|
||||
// Load the startup URL if that's not the website that we terminated on.
|
||||
CefRefPtr<CefFrame> 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<CefResourceHandler> ClientHandler::GetResourceHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ClientHandler::OnProtocolExecution(CefRefPtr<CefBrowser> 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<CefBrowser> browser) {
|
||||
std::string devtools_url = browser->GetHost()->GetDevToolsURL(true);
|
||||
if (!devtools_url.empty()) {
|
||||
if (m_bExternalDevTools) {
|
||||
LaunchExternalBrowser(devtools_url); // Open DevTools in an external browser window.
|
||||
}
|
||||
else if (m_OpenDevToolsURLs.find(devtools_url) == m_OpenDevToolsURLs.end()) {
|
||||
m_OpenDevToolsURLs.insert(devtools_url); // Open DevTools in a popup window.
|
||||
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<CefCommandLine> command_line =
|
||||
CefCommandLine::CreateCommandLine();
|
||||
command_line->SetProgram(file_exe);
|
||||
command_line->AppendSwitchWithValue("url", 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) {
|
||||
}
|
||||
|
||||
// static
|
||||
void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
|
||||
}
|
||||
280
atom/atom/client_handler.h
Normal file
280
atom/atom/client_handler.h
Normal file
@@ -0,0 +1,280 @@
|
||||
// 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 <set>
|
||||
#include <string>
|
||||
#include "include/cef_client.h"
|
||||
#include "atom/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<ClientHandler> handler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<CefRefPtr<ProcessMessageDelegate> >
|
||||
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<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<ClientHandler> handler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<CefRefPtr<RequestDelegate> > RequestDelegateSet;
|
||||
|
||||
ClientHandler();
|
||||
virtual ~ClientHandler();
|
||||
|
||||
// CefClient methods
|
||||
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message)
|
||||
OVERRIDE;
|
||||
|
||||
// CefContextMenuHandler methods
|
||||
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model) OVERRIDE;
|
||||
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
EventFlags event_flags) OVERRIDE;
|
||||
|
||||
// CefDisplayHandler methods
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) OVERRIDE;
|
||||
virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) OVERRIDE;
|
||||
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) OVERRIDE;
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) OVERRIDE;
|
||||
|
||||
// CefDownloadHandler methods
|
||||
virtual void OnBeforeDownload(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) OVERRIDE;
|
||||
virtual void OnDownloadUpdated(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
CefRefPtr<CefDownloadItemCallback> callback) OVERRIDE;
|
||||
|
||||
// CefGeolocationHandler methods
|
||||
virtual void OnRequestGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url,
|
||||
int request_id,
|
||||
CefRefPtr<CefGeolocationCallback> callback) OVERRIDE;
|
||||
|
||||
// CefKeyboardHandler methods
|
||||
virtual bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event,
|
||||
bool* is_keyboard_shortcut) OVERRIDE;
|
||||
|
||||
// CefLifeSpanHandler methods
|
||||
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
virtual bool DoClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
|
||||
// CefLoadHandler methods
|
||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) OVERRIDE;
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) OVERRIDE;
|
||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) OVERRIDE;
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) OVERRIDE;
|
||||
|
||||
// CefRequestHandler methods
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) OVERRIDE;
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> 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<CefBrowser> 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 CloseMainWindow();
|
||||
|
||||
void ShowDevTools(CefRefPtr<CefBrowser> 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:
|
||||
|
||||
// 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<CefMenuModel> 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<CefBrowser> 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<std::string> 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_
|
||||
63
atom/atom/client_handler_gtk.cpp
Normal file
63
atom/atom/client_handler_gtk.cpp
Normal file
@@ -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 <gtk/gtk.h>
|
||||
#include <string>
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> 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<CefBrowser> 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();
|
||||
}
|
||||
32
atom/atom/client_handler_mac.mm
Normal file
32
atom/atom/client_handler_mac.mm
Normal file
@@ -0,0 +1,32 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "include/cef_browser.h"
|
||||
#import "include/cef_frame.h"
|
||||
#import "atom/client_handler.h"
|
||||
|
||||
#ifndef PROCESS_HELPER_APP
|
||||
CefRefPtr<ClientHandler> g_handler;
|
||||
#endif
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) {
|
||||
REQUIRE_UI_THREAD();
|
||||
}
|
||||
|
||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
REQUIRE_UI_THREAD();
|
||||
}
|
||||
|
||||
void ClientHandler::CloseMainWindow() {
|
||||
NSWindow* window = nil;
|
||||
#ifndef PROCESS_HELPER_APP
|
||||
if (g_handler.get()) window = (NSWindow *)g_handler->GetMainHwnd();
|
||||
#endif
|
||||
|
||||
[window performSelectorOnMainThread:@selector(close) withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
return std::string();
|
||||
}
|
||||
86
atom/atom/client_handler_win.cpp
Normal file
86
atom/atom/client_handler_win.cpp
Normal file
@@ -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 <string>
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "cefclient/resource.h"
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> 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<CefBrowser> 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;
|
||||
}
|
||||
3
atom/atom/mac/English.lproj/InfoPlist.strings
Normal file
3
atom/atom/mac/English.lproj/InfoPlist.strings
Normal file
@@ -0,0 +1,3 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
NSHumanReadableCopyright = "© Chromium Embedded Framework Authors, 2010";
|
||||
1983
atom/atom/mac/English.lproj/MainMenu.xib
Normal file
1983
atom/atom/mac/English.lproj/MainMenu.xib
Normal file
File diff suppressed because it is too large
Load Diff
BIN
atom/atom/mac/atom.icns
Normal file
BIN
atom/atom/mac/atom.icns
Normal file
Binary file not shown.
30
atom/atom/mac/helper-info.plist
Normal file
30
atom/atom/mac/helper-info.plist
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.github.atom.helper</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>LSFileQuarantineEnabled</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.5.0</string>
|
||||
<key>LSUIElement</key>
|
||||
<string>1</string>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
28
atom/atom/mac/info.plist
Normal file
28
atom/atom/mac/info.plist
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>atom.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.github.atom</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>ClientApplicatoin</string>
|
||||
</dict>
|
||||
</plist>
|
||||
29
atom/atom/main_mac.mm
Normal file
29
atom/atom/main_mac.mm
Normal file
@@ -0,0 +1,29 @@
|
||||
#import "include/cef_application_mac.h"
|
||||
#import "atom/cefclient_mac.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
@autoreleasepool {
|
||||
CefMainArgs mainArgs(argc, argv);
|
||||
CefRefPtr<CefApp> app;
|
||||
|
||||
int exit_code = CefExecuteProcess(mainArgs, app.get());
|
||||
if (exit_code >= 0){
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||
ClientApplication *application = (ClientApplication *)[ClientApplication sharedApplication];
|
||||
|
||||
NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
|
||||
NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]];
|
||||
[mainNib instantiateNibWithOwner:application topLevelObjects:nil]; // Execute the secondary process, if any.
|
||||
|
||||
[application createWindow];
|
||||
|
||||
// Run the application message loop.
|
||||
CefRunMessageLoop();
|
||||
}
|
||||
|
||||
// Don't put anything below this line because it won't be executed.
|
||||
return 0;
|
||||
}
|
||||
7
atom/atom/process_helper_mac.cpp
Normal file
7
atom/atom/process_helper_mac.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "include/cef_app.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
CefMainArgs main_args(argc, argv);
|
||||
CefRefPtr<CefApp> app;
|
||||
return CefExecuteProcess(main_args, app); // Execute the secondary process.
|
||||
}
|
||||
BIN
atom/atom/res/cefclient.ico
Normal file
BIN
atom/atom/res/cefclient.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
atom/atom/res/small.ico
Normal file
BIN
atom/atom/res/small.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
19
atom/atom/util.h
Normal file
19
atom/atom/util.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef CEF_TESTS_CEFCLIENT_UTIL_H_
|
||||
#define CEF_TESTS_CEFCLIENT_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_task.h"
|
||||
|
||||
#include <assert.h> // 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 // CEF_TESTS_CEFCLIENT_UTIL_H_
|
||||
@@ -1,2 +1,3 @@
|
||||
rm -rf atom.xcodeproj
|
||||
python tools/gyp/gyp --depth=. atom.gyp
|
||||
|
||||
|
||||
363
cef/cef_paths.gypi
Normal file
363
cef/cef_paths.gypi
Normal file
@@ -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': [
|
||||
'cef/include/cef_app.h',
|
||||
'cef/include/cef_browser.h',
|
||||
'cef/include/cef_browser_process_handler.h',
|
||||
'cef/include/cef_callback.h',
|
||||
'cef/include/cef_client.h',
|
||||
'cef/include/cef_command_line.h',
|
||||
'cef/include/cef_context_menu_handler.h',
|
||||
'cef/include/cef_cookie.h',
|
||||
'cef/include/cef_display_handler.h',
|
||||
'cef/include/cef_dom.h',
|
||||
'cef/include/cef_download_handler.h',
|
||||
'cef/include/cef_download_item.h',
|
||||
'cef/include/cef_focus_handler.h',
|
||||
'cef/include/cef_frame.h',
|
||||
'cef/include/cef_geolocation_handler.h',
|
||||
'cef/include/cef_jsdialog_handler.h',
|
||||
'cef/include/cef_keyboard_handler.h',
|
||||
'cef/include/cef_life_span_handler.h',
|
||||
'cef/include/cef_load_handler.h',
|
||||
'cef/include/cef_menu_model.h',
|
||||
'cef/include/cef_origin_whitelist.h',
|
||||
'cef/include/cef_path_util.h',
|
||||
'cef/include/cef_process_message.h',
|
||||
'cef/include/cef_process_util.h',
|
||||
'cef/include/cef_proxy_handler.h',
|
||||
'cef/include/cef_render_process_handler.h',
|
||||
'cef/include/cef_request.h',
|
||||
'cef/include/cef_request_handler.h',
|
||||
'cef/include/cef_resource_bundle_handler.h',
|
||||
'cef/include/cef_resource_handler.h',
|
||||
'cef/include/cef_response.h',
|
||||
'cef/include/cef_scheme.h',
|
||||
'cef/include/cef_stream.h',
|
||||
'cef/include/cef_string_visitor.h',
|
||||
'cef/include/cef_task.h',
|
||||
'cef/include/cef_url.h',
|
||||
'cef/include/cef_urlrequest.h',
|
||||
'cef/include/cef_v8.h',
|
||||
'cef/include/cef_values.h',
|
||||
'cef/include/cef_web_plugin.h',
|
||||
'cef/include/cef_xml_reader.h',
|
||||
'cef/include/cef_zip_reader.h',
|
||||
],
|
||||
'autogen_capi_includes': [
|
||||
'cef/include/capi/cef_app_capi.h',
|
||||
'cef/include/capi/cef_browser_capi.h',
|
||||
'cef/include/capi/cef_browser_process_handler_capi.h',
|
||||
'cef/include/capi/cef_callback_capi.h',
|
||||
'cef/include/capi/cef_client_capi.h',
|
||||
'cef/include/capi/cef_command_line_capi.h',
|
||||
'cef/include/capi/cef_context_menu_handler_capi.h',
|
||||
'cef/include/capi/cef_cookie_capi.h',
|
||||
'cef/include/capi/cef_display_handler_capi.h',
|
||||
'cef/include/capi/cef_dom_capi.h',
|
||||
'cef/include/capi/cef_download_handler_capi.h',
|
||||
'cef/include/capi/cef_download_item_capi.h',
|
||||
'cef/include/capi/cef_focus_handler_capi.h',
|
||||
'cef/include/capi/cef_frame_capi.h',
|
||||
'cef/include/capi/cef_geolocation_handler_capi.h',
|
||||
'cef/include/capi/cef_jsdialog_handler_capi.h',
|
||||
'cef/include/capi/cef_keyboard_handler_capi.h',
|
||||
'cef/include/capi/cef_life_span_handler_capi.h',
|
||||
'cef/include/capi/cef_load_handler_capi.h',
|
||||
'cef/include/capi/cef_menu_model_capi.h',
|
||||
'cef/include/capi/cef_origin_whitelist_capi.h',
|
||||
'cef/include/capi/cef_path_util_capi.h',
|
||||
'cef/include/capi/cef_process_message_capi.h',
|
||||
'cef/include/capi/cef_process_util_capi.h',
|
||||
'cef/include/capi/cef_proxy_handler_capi.h',
|
||||
'cef/include/capi/cef_render_process_handler_capi.h',
|
||||
'cef/include/capi/cef_request_capi.h',
|
||||
'cef/include/capi/cef_request_handler_capi.h',
|
||||
'cef/include/capi/cef_resource_bundle_handler_capi.h',
|
||||
'cef/include/capi/cef_resource_handler_capi.h',
|
||||
'cef/include/capi/cef_response_capi.h',
|
||||
'cef/include/capi/cef_scheme_capi.h',
|
||||
'cef/include/capi/cef_stream_capi.h',
|
||||
'cef/include/capi/cef_string_visitor_capi.h',
|
||||
'cef/include/capi/cef_task_capi.h',
|
||||
'cef/include/capi/cef_url_capi.h',
|
||||
'cef/include/capi/cef_urlrequest_capi.h',
|
||||
'cef/include/capi/cef_v8_capi.h',
|
||||
'cef/include/capi/cef_values_capi.h',
|
||||
'cef/include/capi/cef_web_plugin_capi.h',
|
||||
'cef/include/capi/cef_xml_reader_capi.h',
|
||||
'cef/include/capi/cef_zip_reader_capi.h',
|
||||
],
|
||||
'autogen_library_side': [
|
||||
'cef/libcef_dll/ctocpp/app_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/app_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/auth_callback_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/auth_callback_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/before_download_callback_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/binary_value_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/binary_value_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/browser_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/browser_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/browser_host_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/browser_host_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/browser_process_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/callback_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/callback_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/client_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/client_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/command_line_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/command_line_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/context_menu_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/context_menu_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/context_menu_params_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/context_menu_params_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/cookie_manager_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/cookie_manager_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/cookie_visitor_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/cookie_visitor_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/domdocument_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/domdocument_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/domevent_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/domevent_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/domevent_listener_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/domevent_listener_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/domnode_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/domnode_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/domvisitor_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/dictionary_value_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/display_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/display_handler_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/download_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/download_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/download_item_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/download_item_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/download_item_callback_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/download_item_callback_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/focus_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/focus_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/frame_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/frame_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/geolocation_callback_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/geolocation_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/jsdialog_callback_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/jsdialog_handler_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/keyboard_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/keyboard_handler_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/life_span_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/life_span_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/list_value_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/list_value_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/load_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/load_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/menu_model_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/menu_model_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/post_data_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/post_data_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/post_data_element_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/post_data_element_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/process_message_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/process_message_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/proxy_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/proxy_handler_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/read_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/read_handler_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/render_process_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/render_process_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/request_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/request_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/request_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/request_handler_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/resource_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/resource_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/response_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/response_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/scheme_registrar_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/stream_reader_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/stream_reader_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/stream_writer_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/stream_writer_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/string_visitor_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/string_visitor_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/task_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/task_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/urlrequest_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/urlrequest_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/urlrequest_client_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/v8accessor_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/v8accessor_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/v8context_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/v8context_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/v8exception_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/v8exception_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/v8handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/v8handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/v8value_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/v8value_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/write_handler_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/write_handler_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/xml_reader_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/xml_reader_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/zip_reader_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/zip_reader_cpptoc.h',
|
||||
],
|
||||
'autogen_client_side': [
|
||||
'cef/libcef_dll/cpptoc/app_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/app_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/auth_callback_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/auth_callback_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/before_download_callback_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/binary_value_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/binary_value_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/browser_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/browser_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/browser_host_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/browser_host_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/browser_process_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/callback_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/callback_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/client_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/client_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/command_line_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/command_line_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/context_menu_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/context_menu_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/context_menu_params_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/context_menu_params_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/cookie_manager_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/cookie_manager_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/domdocument_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/domdocument_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/domevent_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/domevent_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/domevent_listener_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/domevent_listener_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/domnode_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/domnode_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/domvisitor_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/dictionary_value_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/display_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/display_handler_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/download_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/download_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/download_item_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/download_item_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/download_item_callback_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/download_item_callback_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/focus_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/focus_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/frame_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/frame_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/geolocation_callback_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/geolocation_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/jsdialog_callback_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/jsdialog_handler_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/keyboard_handler_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/life_span_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/life_span_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/list_value_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/list_value_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/load_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/load_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/menu_model_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/menu_model_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/post_data_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/post_data_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/post_data_element_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/post_data_element_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/process_message_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/process_message_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/proxy_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/proxy_handler_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/read_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/read_handler_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/render_process_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/render_process_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/request_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/request_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/request_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/request_handler_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/resource_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/resource_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/response_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/response_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/scheme_registrar_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/stream_reader_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/stream_reader_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/stream_writer_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/stream_writer_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/string_visitor_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/string_visitor_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/task_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/task_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/urlrequest_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/urlrequest_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/urlrequest_client_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/v8accessor_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/v8accessor_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/v8context_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/v8context_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/v8exception_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/v8exception_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/v8handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/v8handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/v8value_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/v8value_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
|
||||
'cef/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/write_handler_cpptoc.cc',
|
||||
'cef/libcef_dll/cpptoc/write_handler_cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/xml_reader_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/xml_reader_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/zip_reader_ctocpp.cc',
|
||||
'cef/libcef_dll/ctocpp/zip_reader_ctocpp.h',
|
||||
],
|
||||
},
|
||||
}
|
||||
175
cef/cef_paths2.gypi
Normal file
175
cef/cef_paths2.gypi
Normal file
@@ -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': [
|
||||
'cef/include/cef_base.h',
|
||||
'cef/include/cef_pack_resources.h',
|
||||
'cef/include/cef_pack_strings.h',
|
||||
'cef/include/cef_runnable.h',
|
||||
'cef/include/cef_version.h',
|
||||
'cef/include/internal/cef_build.h',
|
||||
'cef/include/internal/cef_export.h',
|
||||
'cef/include/internal/cef_ptr.h',
|
||||
'cef/include/internal/cef_string.h',
|
||||
'cef/include/internal/cef_string_list.h',
|
||||
'cef/include/internal/cef_string_map.h',
|
||||
'cef/include/internal/cef_string_multimap.h',
|
||||
'cef/include/internal/cef_string_types.h',
|
||||
'cef/include/internal/cef_string_wrappers.h',
|
||||
'cef/include/internal/cef_time.h',
|
||||
'cef/include/internal/cef_tuple.h',
|
||||
'cef/include/internal/cef_types.h',
|
||||
'cef/include/internal/cef_types_wrappers.h',
|
||||
'<@(autogen_cpp_includes)',
|
||||
],
|
||||
'includes_capi': [
|
||||
'cef/include/capi/cef_base_capi.h',
|
||||
'<@(autogen_capi_includes)',
|
||||
],
|
||||
'includes_wrapper': [
|
||||
'cef/include/wrapper/cef_byte_read_handler.h',
|
||||
'cef/include/wrapper/cef_stream_resource_handler.h',
|
||||
'cef/include/wrapper/cef_xml_object.h',
|
||||
'cef/include/wrapper/cef_zip_archive.h',
|
||||
],
|
||||
'includes_win': [
|
||||
'cef/include/internal/cef_types_win.h',
|
||||
'cef/include/internal/cef_win.h',
|
||||
],
|
||||
'includes_mac': [
|
||||
'cef/include/cef_application_mac.h',
|
||||
'cef/include/internal/cef_mac.h',
|
||||
'cef/include/internal/cef_types_mac.h',
|
||||
],
|
||||
'includes_linux': [
|
||||
'cef/include/internal/cef_linux.h',
|
||||
'cef/include/internal/cef_types_linux.h',
|
||||
],
|
||||
'libcef_sources_common': [
|
||||
'cef/libcef_dll/cef_logging.h',
|
||||
'cef/libcef_dll/cpptoc/cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/ctocpp.h',
|
||||
'cef/libcef_dll/libcef_dll.cc',
|
||||
'cef/libcef_dll/libcef_dll2.cc',
|
||||
'cef/libcef_dll/resource.h',
|
||||
'cef/libcef_dll/transfer_util.cpp',
|
||||
'cef/libcef_dll/transfer_util.h',
|
||||
'<@(autogen_library_side)',
|
||||
],
|
||||
'libcef_dll_wrapper_sources_common': [
|
||||
'cef/libcef_dll/cef_logging.h',
|
||||
'cef/libcef_dll/cpptoc/base_cpptoc.h',
|
||||
'cef/libcef_dll/cpptoc/cpptoc.h',
|
||||
'cef/libcef_dll/ctocpp/base_ctocpp.h',
|
||||
'cef/libcef_dll/ctocpp/ctocpp.h',
|
||||
'cef/libcef_dll/transfer_util.cpp',
|
||||
'cef/libcef_dll/transfer_util.h',
|
||||
'cef/libcef_dll/wrapper/cef_byte_read_handler.cc',
|
||||
'cef/libcef_dll/wrapper/cef_stream_resource_handler.cc',
|
||||
'cef/libcef_dll/wrapper/cef_xml_object.cc',
|
||||
'cef/libcef_dll/wrapper/cef_zip_archive.cc',
|
||||
'cef/libcef_dll/wrapper/libcef_dll_wrapper.cc',
|
||||
'cef/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',
|
||||
],
|
||||
},
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user