Merge revision 1062 changes:

- Windows: Change CefBrowser::SetOSModalLoop to CefSetOSModalLoop because the functionality is not connected with any particular browser (issue #194).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1271@1064 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-01-28 18:49:42 +00:00
parent 8ff19f8ccb
commit 279fca9e80
14 changed files with 50 additions and 60 deletions

View File

@ -87,6 +87,12 @@ CEF_EXPORT void cef_run_message_loop();
/// ///
CEF_EXPORT void cef_quit_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 // Implement this structure to provide handler implementations. Methods will be
// called on the thread indicated. // called on the thread indicated.

View File

@ -302,13 +302,6 @@ typedef struct _cef_browser_t {
// Send a capture lost event to the browser. // Send a capture lost event to the browser.
/// ///
void (CEF_CALLBACK *send_capture_lost_event)(struct _cef_browser_t* self); void (CEF_CALLBACK *send_capture_lost_event)(struct _cef_browser_t* self);
///
// Set to true (1) before calling Windows APIs like TrackPopupMenu that enter
// a modal message loop.
///
void (CEF_CALLBACK *set_osmodal_loop)(struct _cef_browser_t* self,
int osModalLoop);
} cef_browser_t; } cef_browser_t;

View File

@ -91,6 +91,12 @@ void CefRunMessageLoop();
/*--cef()--*/ /*--cef()--*/
void CefQuitMessageLoop(); 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 // Implement this interface to provide handler implementations. Methods will be

View File

@ -339,13 +339,6 @@ class CefBrowser : public virtual CefBase {
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void SendCaptureLostEvent() =0; virtual void SendCaptureLostEvent() =0;
///
// Set to true before calling Windows APIs like TrackPopupMenu that enter a
// modal message loop.
///
/*--cef()--*/
virtual void SetOSModalLoop(bool osModalLoop) =0;
}; };
#endif // CEF_INCLUDE_CEF_BROWSER_H_ #endif // CEF_INCLUDE_CEF_BROWSER_H_

View File

@ -361,11 +361,6 @@ void CefBrowserImpl::CloseDevTools() {
base::Bind(&CefBrowserImpl::UIT_CloseDevTools, this)); base::Bind(&CefBrowserImpl::UIT_CloseDevTools, this));
} }
#if !defined(OS_WIN)
void CefBrowserImpl::SetOSModalLoop(bool osModalLoop) {
}
#endif
WebKit::WebGeolocationClient* CefBrowserImpl::UIT_GetGeolocationClient() { WebKit::WebGeolocationClient* CefBrowserImpl::UIT_GetGeolocationClient() {
if (!geolocation_client_) if (!geolocation_client_)
geolocation_client_ = new CefGeolocationClient(this); geolocation_client_ = new CefGeolocationClient(this);

View File

@ -116,7 +116,6 @@ class CefBrowserImpl : public CefBrowser {
OVERRIDE; OVERRIDE;
virtual void SendFocusEvent(bool setFocus) OVERRIDE; virtual void SendFocusEvent(bool setFocus) OVERRIDE;
virtual void SendCaptureLostEvent() OVERRIDE; virtual void SendCaptureLostEvent() OVERRIDE;
virtual void SetOSModalLoop(bool osModalLoop) OVERRIDE;
// Frame-related methods // Frame-related methods
void Undo(CefRefPtr<CefFrame> frame); void Undo(CefRefPtr<CefFrame> frame);

View File

@ -148,15 +148,6 @@ bool CefBrowserImpl::IsWindowRenderingDisabled() {
return (window_info_.m_bWindowRenderingDisabled ? true : false); return (window_info_.m_bWindowRenderingDisabled ? true : false);
} }
void CefBrowserImpl::SetOSModalLoop(bool osModalLoop) {
if (CefThread::CurrentlyOn(CefThread::UI)) {
MessageLoop::current()->set_os_modal_loop(osModalLoop);
} else {
CefThread::PostTask(CefThread::UI, FROM_HERE,
base::Bind(&CefBrowserImpl::SetOSModalLoop, this, osModalLoop));
}
}
gfx::NativeWindow CefBrowserImpl::UIT_GetMainWndHandle() { gfx::NativeWindow CefBrowserImpl::UIT_GetMainWndHandle() {
REQUIRE_UIT(); REQUIRE_UIT();
return window_info_.m_bWindowRenderingDisabled ? return window_info_.m_bWindowRenderingDisabled ?

View File

@ -60,7 +60,7 @@ base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
: base::StringPiece(); : base::StringPiece();
} }
#endif // defined(OS_MACOSX) #endif // defined(OS_WIN)
} // namespace } // namespace
@ -215,6 +215,23 @@ void CefQuitMessageLoop() {
_Context->process()->QuitMessageLoop(); _Context->process()->QuitMessageLoop();
} }
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 (CefThread::CurrentlyOn(CefThread::UI)) {
MessageLoop::current()->set_os_modal_loop(osModalLoop);
} else {
CefThread::PostTask(CefThread::UI, FROM_HERE,
base::Bind(CefSetOSModalLoop, osModalLoop));
}
#endif // defined(OS_WIN)
}
// CefContext // CefContext

View File

@ -717,19 +717,6 @@ void CEF_CALLBACK browser_send_capture_lost_event(struct _cef_browser_t* self) {
CefBrowserCppToC::Get(self)->SendCaptureLostEvent(); CefBrowserCppToC::Get(self)->SendCaptureLostEvent();
} }
void CEF_CALLBACK browser_set_osmodal_loop(struct _cef_browser_t* self,
int osModalLoop) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefBrowserCppToC::Get(self)->SetOSModalLoop(
osModalLoop?true:false);
}
// CONSTRUCTOR - Do not edit by hand. // CONSTRUCTOR - Do not edit by hand.
@ -776,7 +763,6 @@ CefBrowserCppToC::CefBrowserCppToC(CefBrowser* cls)
struct_.struct_.send_mouse_wheel_event = browser_send_mouse_wheel_event; struct_.struct_.send_mouse_wheel_event = browser_send_mouse_wheel_event;
struct_.struct_.send_focus_event = browser_send_focus_event; struct_.struct_.send_focus_event = browser_send_focus_event;
struct_.struct_.send_capture_lost_event = browser_send_capture_lost_event; struct_.struct_.send_capture_lost_event = browser_send_capture_lost_event;
struct_.struct_.set_osmodal_loop = browser_set_osmodal_loop;
} }
#ifndef NDEBUG #ifndef NDEBUG

View File

@ -583,17 +583,6 @@ void CefBrowserCToCpp::SendCaptureLostEvent() {
struct_->send_capture_lost_event(struct_); struct_->send_capture_lost_event(struct_);
} }
void CefBrowserCToCpp::SetOSModalLoop(bool osModalLoop) {
if (CEF_MEMBER_MISSING(struct_, set_osmodal_loop))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
struct_->set_osmodal_loop(struct_,
osModalLoop);
}
#ifndef NDEBUG #ifndef NDEBUG
template<> long CefCToCpp<CefBrowserCToCpp, CefBrowser, template<> long CefCToCpp<CefBrowserCToCpp, CefBrowser,

View File

@ -80,7 +80,6 @@ class CefBrowserCToCpp
int deltaY) OVERRIDE; int deltaY) OVERRIDE;
virtual void SendFocusEvent(bool setFocus) OVERRIDE; virtual void SendFocusEvent(bool setFocus) OVERRIDE;
virtual void SendCaptureLostEvent() OVERRIDE; virtual void SendCaptureLostEvent() OVERRIDE;
virtual void SetOSModalLoop(bool osModalLoop) OVERRIDE;
}; };
#endif // USING_CEF_SHARED #endif // USING_CEF_SHARED

View File

@ -199,6 +199,14 @@ CEF_EXPORT void cef_quit_message_loop() {
CefQuitMessageLoop(); 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( CEF_EXPORT int cef_get_geolocation(
struct _cef_get_geolocation_callback_t* callback) { struct _cef_get_geolocation_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@ -201,6 +201,14 @@ CEF_GLOBAL void CefQuitMessageLoop() {
cef_quit_message_loop(); 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( CEF_GLOBAL bool CefGetGeolocation(
CefRefPtr<CefGetGeolocationCallback> callback) { CefRefPtr<CefGetGeolocationCallback> callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@ -606,16 +606,16 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
break; break;
case WM_ENTERMENULOOP: case WM_ENTERMENULOOP:
if (!wParam && g_handler.get() && g_handler->GetBrowserHwnd()) { if (!wParam) {
// Entering the menu loop for the application menu. // Entering the menu loop for the application menu.
g_handler->GetBrowser()->SetOSModalLoop(true); CefSetOSModalLoop(true);
} }
break; break;
case WM_EXITMENULOOP: case WM_EXITMENULOOP:
if (!wParam && g_handler.get() && g_handler->GetBrowserHwnd()) { if (!wParam) {
// Exiting the menu loop for the application menu. // Exiting the menu loop for the application menu.
g_handler->GetBrowser()->SetOSModalLoop(false); CefSetOSModalLoop(false);
} }
break; break;