Add CefSetOSModalLoop function (issue #194).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1384 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
073a20b973
commit
518888dc55
|
@ -100,6 +100,12 @@ CEF_EXPORT void cef_run_message_loop();
|
|||
///
|
||||
CEF_EXPORT void cef_quit_message_loop();
|
||||
|
||||
///
|
||||
// Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a
|
||||
// modal message loop. Set to false (0) after exiting the modal message loop.
|
||||
///
|
||||
CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop);
|
||||
|
||||
///
|
||||
// Implement this structure to provide handler implementations. Methods will be
|
||||
// called by the process and/or thread indicated.
|
||||
|
|
|
@ -107,6 +107,13 @@ void CefRunMessageLoop();
|
|||
/*--cef()--*/
|
||||
void CefQuitMessageLoop();
|
||||
|
||||
///
|
||||
// Set to true before calling Windows APIs like TrackPopupMenu that enter a
|
||||
// modal message loop. Set to false after exiting the modal message loop.
|
||||
///
|
||||
/*--cef()--*/
|
||||
void CefSetOSModalLoop(bool osModalLoop);
|
||||
|
||||
///
|
||||
// Implement this interface to provide handler implementations. Methods will be
|
||||
// called by the process and/or thread indicated.
|
||||
|
|
|
@ -160,6 +160,21 @@ void CefQuitMessageLoop() {
|
|||
CefBrowserMessageLoop::current()->Quit();
|
||||
}
|
||||
|
||||
void CefSetOSModalLoop(bool osModalLoop) {
|
||||
#if defined(OS_WIN)
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
return;
|
||||
}
|
||||
|
||||
if (CEF_CURRENTLY_ON_UIT())
|
||||
MessageLoop::current()->set_os_modal_loop(osModalLoop);
|
||||
else
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(CefSetOSModalLoop, osModalLoop));
|
||||
#endif // defined(OS_WIN)
|
||||
}
|
||||
|
||||
|
||||
// CefContext
|
||||
|
||||
|
|
|
@ -267,6 +267,14 @@ CEF_EXPORT void cef_quit_message_loop() {
|
|||
CefQuitMessageLoop();
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
CefSetOSModalLoop(
|
||||
osModalLoop?true:false);
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_get_geolocation(
|
||||
struct _cef_get_geolocation_callback_t* callback) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
|
|
@ -259,6 +259,14 @@ CEF_GLOBAL void CefQuitMessageLoop() {
|
|||
cef_quit_message_loop();
|
||||
}
|
||||
|
||||
CEF_GLOBAL void CefSetOSModalLoop(bool osModalLoop) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_set_osmodal_loop(
|
||||
osModalLoop);
|
||||
}
|
||||
|
||||
CEF_GLOBAL bool CefGetGeolocation(
|
||||
CefRefPtr<CefGetGeolocationCallback> callback) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
|
|
@ -492,6 +492,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_ENTERMENULOOP:
|
||||
if (!wParam) {
|
||||
// Entering the menu loop for the application menu.
|
||||
CefSetOSModalLoop(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_EXITMENULOOP:
|
||||
if (!wParam) {
|
||||
// Exiting the menu loop for the application menu.
|
||||
CefSetOSModalLoop(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
if (g_handler.get() && !g_handler->IsClosing()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
|
|
Loading…
Reference in New Issue