Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

CEF 3683 on Linux #666

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function (grunt) {
if (platform === "mac") {
cef_version = "3.2704.1434";
} else if (platform === "linux") {
cef_version = "3.2785.1487";
cef_version = "3.3683.1920.g9f41a27";
}

grunt.initConfig({
Expand Down
5 changes: 4 additions & 1 deletion appshell.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9',
'defines': [
'USING_CEF_SHARED',
'WRAPPING_CEF_SHARED',
],
'configurations': {
'Common_Base': {
Expand All @@ -459,6 +460,7 @@
'<@(includes_common)',
'<@(includes_capi)',
'<@(includes_wrapper)',
'<@(libcef_dll_wrapper_sources_base)',
'<@(libcef_dll_wrapper_sources_common)',
],
'xcode_settings': {
Expand Down Expand Up @@ -628,4 +630,5 @@
},
}],
],
}
}

2 changes: 1 addition & 1 deletion appshell/appshell_extension_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class AppShellExtensionHandler : public CefV8Handler {
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
CefString& exception) {
CefString& exception) OVERRIDE {

// The only messages that are handled here is getElapsedMilliseconds(),
// GetCurrentLanguage(), GetApplicationSupportDirectory(), and GetRemoteDebuggingPort().
Expand Down
5 changes: 3 additions & 2 deletions appshell/appshell_extensions_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <unicode/ucsdet.h>
#include <unicode/ucnv.h>
#include <fstream>
#include <memory>

#ifdef OS_LINUX
#include "appshell/browser/main_context.h"
Expand Down Expand Up @@ -71,7 +72,7 @@ void CharSetEncode::operator()(std::string &contents) {
if(error != U_BUFFER_OVERFLOW_ERROR) {
throw "Unable to convert encoding";
}
std::auto_ptr<char> target(new char[targetLen + 1]());
std::unique_ptr<char> target(new char[targetLen + 1]());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this required? Is it just for a safety enhancement?

error = U_ZERO_ERROR;
ustr.extract(target.get(), targetLen, m_conv, error);
target.get()[targetLen] = '\0';
Expand All @@ -87,7 +88,7 @@ void DecodeContents(std::string &contents, const std::string& encoding) {
if(status != U_BUFFER_OVERFLOW_ERROR) {
throw "Unable to decode contents";
}
std::auto_ptr<char> target(new char[targetLen + 1]());
std::unique_ptr<char> target(new char[targetLen + 1]());
status = U_ZERO_ERROR;
ustr.extract(target.get(), targetLen, NULL, status);
target.get()[targetLen] = '\0';
Expand Down
2 changes: 1 addition & 1 deletion appshell/browser/client_app_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ClientAppBrowser : public ClientApp,
// Interface for browser delegates. All Delegates must be returned via
// CreateDelegates. Do not perform work in the Delegate
// constructor. See CefBrowserProcessHandler for documentation.
class Delegate : public virtual CefBase {
class Delegate : public virtual CefBaseRefCounted {
public:
virtual void OnBeforeCommandLineProcessing(
CefRefPtr<ClientAppBrowser> app,
Expand Down
32 changes: 4 additions & 28 deletions appshell/browser/client_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,32 +272,6 @@ void ClientHandler::OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
NotifyFullscreen(fullscreen);
}

bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we leave the stub for debugging purposes?

const CefString& message,
const CefString& source,
int line) {
CEF_REQUIRE_UI_THREAD();

// FILE* file = fopen(console_log_file_.c_str(), "a");
// if (file) {
// std::stringstream ss;
// ss << "Message: " << message.ToString() << NEWLINE <<
// "Source: " << source.ToString() << NEWLINE <<
// "Line: " << line << NEWLINE <<
// "-----------------------" << NEWLINE;
// fputs(ss.str().c_str(), file);
// fclose(file);

// if (first_console_message_) {
// test_runner::Alert(
// browser, "Console messages written to \"" + console_log_file_ + "\"");
// first_console_message_ = false;
// }
// }

return false;
}

void ClientHandler::OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
Expand Down Expand Up @@ -347,7 +321,6 @@ void ClientHandler::OnDraggableRegionsChanged(

NotifyDraggableRegions(regions);
}
#endif

bool ClientHandler::OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,
Expand All @@ -360,6 +333,7 @@ bool ClientHandler::OnRequestGeolocationPermission(
callback->Continue(true);
return true;
}
#endif

bool ClientHandler::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
const CefKeyEvent& event,
Expand Down Expand Up @@ -393,7 +367,7 @@ bool ClientHandler::OnBeforePopup(
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access) {
CEF_REQUIRE_IO_THREAD();
CEF_REQUIRE_UI_THREAD();

// Return true to cancel the popup window.
return !CreatePopupWindow(browser, false, popupFeatures, windowInfo, client,
Expand Down Expand Up @@ -577,6 +551,7 @@ bool ClientHandler::OnCertificateError(
CefRefPtr<CefRequestCallback> callback) {
CEF_REQUIRE_UI_THREAD();

#if 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to remove this or add a configurable MACRO to handle this.

CefRefPtr<CefSSLCertPrincipal> subject = ssl_info->GetSubject();
CefRefPtr<CefSSLCertPrincipal> issuer = ssl_info->GetIssuer();

Expand Down Expand Up @@ -622,6 +597,7 @@ bool ClientHandler::OnCertificateError(

// Load the error page.
LoadErrorPage(browser->GetMainFrame(), request_url, cert_error, ss.str());
#endif

return false; // Cancel the request.
}
Expand Down
18 changes: 1 addition & 17 deletions appshell/browser/client_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class ClientHandler :
public CefDisplayHandler,
public CefDownloadHandler,
public CefDragHandler,
public CefGeolocationHandler,
public CefKeyboardHandler,
public CefLifeSpanHandler,
public CefLoadHandler,
Expand Down Expand Up @@ -111,9 +110,6 @@ class ClientHandler :
}
#endif

CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE {
return this;
}
CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE {
return this;
}
Expand Down Expand Up @@ -159,11 +155,6 @@ class ClientHandler :
const CefString& title) OVERRIDE;
void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
bool fullscreen) OVERRIDE;
bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
const CefString& message,
const CefString& source,
int line) OVERRIDE;

// CefDownloadHandler methods
void OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
Expand All @@ -190,13 +181,6 @@ class ClientHandler :
const std::vector<CefDraggableRegion>& regions) OVERRIDE;
#endif

// CefGeolocationHandler methods
bool OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,
const CefString& requesting_url,
int request_id,
CefRefPtr<CefGeolocationCallback> callback) OVERRIDE;

// CefKeyboardHandler methods
bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
const CefKeyEvent& event,
Expand Down Expand Up @@ -235,7 +219,7 @@ class ClientHandler :
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect) OVERRIDE;
bool is_redirect);
bool OnOpenURLFromTab(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
Expand Down
5 changes: 4 additions & 1 deletion appshell/browser/print_handler_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ void ClientPrintHandlerGtk::OnPrintStart(CefRefPtr<CefBrowser> browser) {
}

void ClientPrintHandlerGtk::OnPrintSettings(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefPrintSettings> settings,
bool get_defaults) {
if (get_defaults) {
Expand Down Expand Up @@ -357,6 +358,7 @@ void ClientPrintHandlerGtk::OnPrintSettings(
}

bool ClientPrintHandlerGtk::OnPrintDialog(
CefRefPtr<CefBrowser> browser,
bool has_selection,
CefRefPtr<CefPrintDialogCallback> callback) {
dialog_callback_ = callback;
Expand Down Expand Up @@ -398,6 +400,7 @@ bool ClientPrintHandlerGtk::OnPrintDialog(
}

bool ClientPrintHandlerGtk::OnPrintJob(
CefRefPtr<CefBrowser> browser,
const CefString& document_name,
const CefString& pdf_file_path,
CefRefPtr<CefPrintJobCallback> callback) {
Expand All @@ -424,7 +427,7 @@ bool ClientPrintHandlerGtk::OnPrintJob(
return true;
}

void ClientPrintHandlerGtk::OnPrintReset() {
void ClientPrintHandlerGtk::OnPrintReset( CefRefPtr<CefBrowser> browser) {
if (dialog_) {
gtk_widget_destroy(dialog_);
dialog_ = NULL;
Expand Down
11 changes: 7 additions & 4 deletions appshell/browser/print_handler_gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ class ClientPrintHandlerGtk : public CefPrintHandler {

// CefPrintHandler methods.
void OnPrintStart(CefRefPtr<CefBrowser> browser) OVERRIDE;
void OnPrintSettings(CefRefPtr<CefPrintSettings> settings,
void OnPrintSettings(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefPrintSettings> settings,
bool get_defaults) OVERRIDE;
bool OnPrintDialog(
CefRefPtr<CefBrowser> browser,
bool has_selection,
CefRefPtr<CefPrintDialogCallback> callback) OVERRIDE;
bool OnPrintJob(const CefString& document_name,
bool OnPrintJob(CefRefPtr<CefBrowser> browser,
const CefString& document_name,
const CefString& pdf_file_path,
CefRefPtr<CefPrintJobCallback> callback) OVERRIDE;
void OnPrintReset() OVERRIDE;
CefRefPtr<CefPrintJobCallback> callback);
void OnPrintReset(CefRefPtr<CefBrowser> browser) OVERRIDE;
CefSize GetPdfPaperSize(int device_units_per_inch) OVERRIDE;

private:
Expand Down
1 change: 1 addition & 0 deletions appshell/browser/root_window_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ClientRequestContextHandler : public CefRequestContextHandler {

bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,
bool is_main_frame,
const CefString& top_origin_url,
CefRefPtr<CefWebPluginInfo> plugin_info,
PluginPolicy* plugin_policy) OVERRIDE {
Expand Down
2 changes: 1 addition & 1 deletion appshell/cefclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CefRefPtr<CefBrowser> AppGetBrowser() {

CefWindowHandle AppGetMainHwnd() {
if (!g_handler.get())
return NULL;
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using an explicit integer for pointer here? CefWindowHandle is defined as HWND on Windows, NSView* on Mac OS X and GtkWidget* on Linux.

NULL seemed like a better choice. nullptr even better to handle type ambiguity with int.

return g_handler->GetMainHwnd();
}

Expand Down
2 changes: 0 additions & 2 deletions appshell/cefclient_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,5 @@ int RunMain(int argc, char* argv[]) {

// Program entry point function.
int main(int argc, char* argv[]) {
char extra_option[] ="--disable-gpu";
argv[argc]=extra_option; ++argc;
return client::RunMain(argc, argv);
}
10 changes: 7 additions & 3 deletions appshell/client_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ClientApp : public CefApp,
// Interface for renderer delegates. All RenderDelegates must be returned via
// CreateRenderDelegates. Do not perform work in the RenderDelegate
// constructor. See CefRenderProcessHandler for documentation.
class RenderDelegate : public virtual CefBase {
class RenderDelegate : public virtual CefBaseRefCounted {
public:
virtual void OnRenderThreadCreated(CefRefPtr<ClientApp> app,
CefRefPtr<CefListValue> extra_info) {}
Expand Down Expand Up @@ -93,11 +93,11 @@ class ClientApp : public CefApp,
static void CreateRenderDelegates(RenderDelegateSet& delegates);

// Registers custom schemes. Implemented in client_app_delegates.
static void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar);
static void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar);

// CefApp methods.
virtual void OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE {
CefRawPtr<CefSchemeRegistrar> registrar) OVERRIDE {
RegisterCustomSchemes(registrar);
}
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler()
Expand All @@ -121,6 +121,10 @@ class ClientApp : public CefApp,
CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE;
virtual void OnBeforeCommandLineProcessing(const CefString& process_type,CefRefPtr<CefCommandLine> command_line) override
{
command_line->AppendSwitch("--disable-web-security");
}

// Set of supported RenderDelegates.
RenderDelegateSet render_delegates_;
Expand Down
2 changes: 1 addition & 1 deletion appshell/client_app_delegates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) {
}

// static
void ClientApp::RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar) {
void ClientApp::RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) {
}
Loading