-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide default implementation for js and file dialogs on Linux (#241)…
…... In wxpython.py and gtk2.py examples the js alert dialog when run from a popup gives focus to the main window. The popup window is created internally by CEF and this probably needs to be changed so that popups are created by wx in OnBeforePopup and this will resolve issue with alert focus. In qt4.py and tkinter.py and hello_world.py examples focus works fine in the popup window. Add --hello-world flag to build.py and run_examples.py tools.
- Loading branch information
Showing
15 changed files
with
704 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2017 CEF Python, see the Authors file. | ||
// All rights reserved. Licensed under BSD 3-clause license. | ||
// Project website: https://github.com/cztomczak/cefpython | ||
|
||
#include "dialog_handler.h" | ||
|
||
|
||
DialogHandler::DialogHandler() | ||
{ | ||
#if defined(OS_LINUX) | ||
// Provide the GTK-based default dialog implementation on Linux. | ||
dialog_handler_ = new ClientDialogHandlerGtk(); | ||
#endif | ||
} | ||
|
||
|
||
bool DialogHandler::OnFileDialog(CefRefPtr<CefBrowser> browser, | ||
FileDialogMode mode, | ||
const CefString& title, | ||
const CefString& default_file_path, | ||
const std::vector<CefString>& accept_filters, | ||
int selected_accept_filter, | ||
CefRefPtr<CefFileDialogCallback> callback) | ||
{ | ||
#if defined(OS_LINUX) | ||
return dialog_handler_->OnFileDialog(browser, | ||
mode, | ||
title, | ||
default_file_path, | ||
accept_filters, | ||
selected_accept_filter, | ||
callback); | ||
#else | ||
return false; | ||
#endif | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2017 CEF Python, see the Authors file. | ||
// All rights reserved. Licensed under BSD 3-clause license. | ||
// Project website: https://github.com/cztomczak/cefpython | ||
|
||
#pragma once | ||
|
||
#include "common/cefpython_public_api.h" | ||
#include "include/cef_dialog_handler.h" | ||
|
||
#if defined(OS_LINUX) | ||
#include "dialog_handler_gtk.h" | ||
#endif | ||
|
||
|
||
class DialogHandler : public CefDialogHandler | ||
{ | ||
public: | ||
DialogHandler(); | ||
virtual ~DialogHandler(){} | ||
|
||
bool OnFileDialog(CefRefPtr<CefBrowser> browser, | ||
FileDialogMode mode, | ||
const CefString& title, | ||
const CefString& default_file_path, | ||
const std::vector<CefString>& accept_filters, | ||
int selected_accept_filter, | ||
CefRefPtr<CefFileDialogCallback> callback) | ||
override; | ||
|
||
public: | ||
#if defined(OS_LINUX) | ||
// Default dialog handler impl for GTK. | ||
CefRefPtr<ClientDialogHandlerGtk> dialog_handler_; | ||
#endif | ||
|
||
private: | ||
IMPLEMENT_REFCOUNTING(DialogHandler); | ||
}; |
Oops, something went wrong.