- Fix compile errors.
- Add support for creating hidden windows and TEST_REDIRECT_POPUP_URLS.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@201 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-03-08 03:54:50 +00:00
parent 7b1166b18a
commit 11b831119a
11 changed files with 107 additions and 64 deletions

View File

@@ -9,6 +9,10 @@
#include "download_handler.h"
#include "util.h"
// Define this value to redirect all popup URLs to the main application browser
// window.
//s#define TEST_REDIRECT_POPUP_URLS
// Client implementation of the browser handler class
class ClientHandler : public CefThreadSafeBase<CefHandler>
{
@@ -420,6 +424,41 @@ protected:
};
#ifdef TEST_REDIRECT_POPUP_URLS
// Handler for popup windows that loads the request in an existing browser
// window.
class ClientPopupHandler : public ClientHandler
{
public:
ClientPopupHandler(CefRefPtr<CefBrowser> parentBrowser)
: m_ParentBrowser(parentBrowser)
{
}
virtual ~ClientPopupHandler()
{
}
virtual RetVal HandleBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
NavType navType, bool isRedirect)
{
REQUIRE_UI_THREAD();
if (m_ParentBrowser.get()) {
m_ParentBrowser->GetMainFrame()->LoadRequest(request);
browser->CloseBrowser();
m_ParentBrowser = NULL;
}
return RV_HANDLED;
}
protected:
CefRefPtr<CefBrowser> m_ParentBrowser;
};
#endif // TEST_REDIRECT_POPUP_URLS
// Returns the main browser window instance.
CefRefPtr<CefBrowser> AppGetBrowser();