mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Remove cefclient.cpp and cefclient.h
This commit is contained in:
parent
685536d044
commit
8c97927ce1
3
atom.gyp
3
atom.gyp
@ -46,8 +46,6 @@
|
||||
'sources': [
|
||||
'<@(includes_common)',
|
||||
'<@(includes_wrapper)',
|
||||
'tests/cefclient/cefclient.cpp',
|
||||
'tests/cefclient/cefclient.h',
|
||||
'tests/cefclient/client_app.cpp',
|
||||
'tests/cefclient/client_app.h',
|
||||
'tests/cefclient/client_app_delegates.cpp',
|
||||
@ -254,6 +252,7 @@
|
||||
],
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
'PROCESS_HELPER_APP',
|
||||
],
|
||||
'include_dirs': [
|
||||
'.',
|
||||
|
@ -4,51 +4,3 @@
|
||||
|
||||
#include "cefclient/cefclient.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
|
||||
CefRefPtr<ClientHandler> g_handler;
|
||||
|
||||
CefWindowHandle AppGetMainHwnd() {
|
||||
if (!g_handler.get()) return NULL;
|
||||
return g_handler->GetMainHwnd();
|
||||
}
|
||||
|
||||
// Returns the application browser settings based on command line arguments.
|
||||
void AppGetBrowserSettings(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;
|
||||
}
|
@ -8,10 +8,4 @@
|
||||
|
||||
#include "cefclient/client_app.h"
|
||||
|
||||
// Returns the main application window handle.
|
||||
CefWindowHandle AppGetMainHwnd();
|
||||
|
||||
// Returns the application browser settings based on command line arguments.
|
||||
void AppGetBrowserSettings(CefBrowserSettings& settings);
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_H_
|
||||
|
@ -182,6 +182,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
||||
// Receives notifications from the application. Will delete itself when done.
|
||||
@interface ClientAppDelegate : NSObject
|
||||
- (void)createApp:(id)object;
|
||||
- (void)populateBrowserSettings:(CefBrowserSettings &)settings;
|
||||
@end
|
||||
|
||||
@implementation ClientAppDelegate
|
||||
@ -265,8 +266,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
||||
CefWindowInfo window_info;
|
||||
CefBrowserSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetBrowserSettings(settings);
|
||||
[self populateBrowserSettings:settings];
|
||||
|
||||
window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight);
|
||||
CefBrowserHost::CreateBrowser(window_info, g_handler.get(),
|
||||
@ -282,6 +282,46 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
||||
[mainWnd setFrame:[mainWnd frameRectForContentRect:r] display:YES];
|
||||
}
|
||||
|
||||
- (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;
|
||||
}
|
||||
|
||||
// Sent by the default notification center immediately before the application
|
||||
// terminates.
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
|
@ -9,6 +9,10 @@
|
||||
#include "include/cef_frame.h"
|
||||
#include "cefclient/cefclient.h"
|
||||
|
||||
#ifndef PROCESS_HELPER_APP
|
||||
CefRefPtr<ClientHandler> g_handler;
|
||||
#endif
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) {
|
||||
@ -52,7 +56,11 @@ void ClientHandler::SendNotification(NotificationType type) {
|
||||
if (sel == nil)
|
||||
return;
|
||||
|
||||
NSWindow* window = [AppGetMainHwnd() window];
|
||||
NSWindow* window = nil;
|
||||
#ifndef PROCESS_HELPER_APP
|
||||
if (g_handler.get()) window = (NSWindow *)g_handler->GetMainHwnd();
|
||||
#endif
|
||||
|
||||
NSObject* delegate = [window delegate];
|
||||
[delegate performSelectorOnMainThread:sel withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
@ -12,9 +12,6 @@
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return std::string();
|
||||
}
|
||||
CefWindowHandle AppGetMainHwnd() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Process entry point.
|
||||
int main(int argc, char* argv[]) {
|
||||
|
Loading…
Reference in New Issue
Block a user