mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
libcef:
- Add support for specifying the cache location (file path or in-memory) via a new 'cache_path' parameter to CefInitialize(). - Create popup windows with a NULL parent window handle so that they don't stay on top of the original application window. cefclient: - Properly handle address change and title change for popup windows. - Add a test for creating a popup window. - Define TEST_SINGLE_THREADED_MESSAGE_LOOP by default. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@18 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
|
||||
// Define this value to run CEF with messages processed using the current
|
||||
// application's message loop.
|
||||
//#define TEST_SINGLE_THREADED_MESSAGE_LOOP
|
||||
#define TEST_SINGLE_THREADED_MESSAGE_LOOP
|
||||
|
||||
// Global Variables:
|
||||
HINSTANCE hInst; // current instance
|
||||
@ -41,10 +41,10 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||
#ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP
|
||||
// Initialize the CEF with messages processed using the current application's
|
||||
// message loop.
|
||||
CefInitialize(false);
|
||||
CefInitialize(false, std::wstring());
|
||||
#else
|
||||
// Initialize the CEF with messages processed using a separate UI thread.
|
||||
CefInitialize(true);
|
||||
CefInitialize(true, std::wstring());
|
||||
#endif
|
||||
|
||||
// Structure providing information about the client plugin.
|
||||
@ -384,8 +384,11 @@ public:
|
||||
virtual RetVal HandleAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
const std::wstring& url)
|
||||
{
|
||||
// Set the edit window text
|
||||
SetWindowText(m_EditHwnd, url.c_str());
|
||||
if(m_BrowserHwnd == browser->GetWindowHandle())
|
||||
{
|
||||
// Set the edit window text
|
||||
SetWindowText(m_EditHwnd, url.c_str());
|
||||
}
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
@ -395,7 +398,13 @@ public:
|
||||
const std::wstring& title)
|
||||
{
|
||||
// Set the frame window title bar
|
||||
SetWindowText(m_MainHwnd, title.c_str());
|
||||
HWND hwnd = browser->GetWindowHandle();
|
||||
if(!browser->IsPopup())
|
||||
{
|
||||
// The frame window will be the parent of the browser window
|
||||
hwnd = GetParent(hwnd);
|
||||
}
|
||||
SetWindowText(hwnd, title.c_str());
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
@ -835,6 +844,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
browser->LoadString(html, L"about:blank");
|
||||
}
|
||||
return 0;
|
||||
case ID_TESTS_POPUP: // Test a popup window
|
||||
if(browser.get())
|
||||
{
|
||||
browser->ExecuteJavaScript(L"window.open('http://www.google.com');",
|
||||
L"about:blank", 0, TF_MAIN);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user