- Add the CefBrowser::CreateBrowserSync() method for synchronously creating a browser instance. (Issue #13, Suggested implementation by: vridosh)
- Add CefBrowser::SetFocus() and CefHandler::HandleTakeFocus() methods to deal with keyboard focus changes. (Issue #13, Suggested implementation by: vridosh)
- Add CefHandler::HandleBeforeWindowClose() to perform actions immediately before the browser window is destroyed. (Issue #13, Suggested implementation by: vridosh)
- Replace windows-specific address resolution code with GURL() in CefBrowserImpl::UIT_LoadURLForRequest(), CefBrowserImpl::UIT_LoadHTML() and CefBrowserImpl::UIT_LoadHTMLForStreamRef(), and move the methods from browser_impl_win.cc to browser_impl.cc. (Issue #13, Suggested implementation by: vridosh)
- Fix reference counting bugs, class definition problems and CefContext::Shutdown() bug resulting in Cef object leaks. (Issue #15)
- Add WebKit dependancy to libcef project.
- Add basic object count debugging for CefCToCpp and CefCppToC classes.

cefclient:
- Initialize the strPtr parameter to avoid URLs suffixed with garbage. (Issue #13, Fix by: vridosh)

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@19 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-03-08 02:26:16 +00:00
parent 3aa0d4c0fa
commit 08a19d5384
37 changed files with 628 additions and 195 deletions

View File

@ -20,8 +20,6 @@
#include <wininet.h>
#include <winspool.h>
#define BUFFER_SIZE 32768
LPCTSTR CefBrowserImpl::GetWndClass()
{
@ -46,6 +44,11 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
case WM_DESTROY:
{
CefRefPtr<CefHandler> handler = browser->GetHandler();
if(handler.get()) {
// Notify the handler that the window is about to be closed
handler->HandleBeforeWindowClose(browser);
}
// Remove the browser from the list maintained by the context
_Context->RemoveBrowser(browser);
}
@ -295,78 +298,6 @@ void CefBrowserImpl::UIT_CreateBrowser()
if(url_.size() > 0)
UIT_LoadURL(url_.c_str());
}
void CefBrowserImpl::UIT_LoadURLForRequest(const std::wstring& url,
const std::wstring& frame_name,
const std::wstring& method,
net::UploadData *upload_data,
const WebRequest::HeaderMap& headers)
{
REQUIRE_UIT();
if (url.empty())
return;
std::wstring urlString(url);
if (PathFileExists(url.c_str()) || PathIsUNC(url.c_str())) {
TCHAR fileURL[INTERNET_MAX_URL_LENGTH];
DWORD fileURLLength = sizeof(fileURL)/sizeof(fileURL[0]);
if (SUCCEEDED(UrlCreateFromPath(url.c_str(), fileURL, &fileURLLength, 0)))
urlString.assign(fileURL);
}
nav_controller_->LoadEntry(new BrowserNavigationEntry(
-1, GURL(urlString), std::wstring(), frame_name, method, upload_data,
headers));
}
void CefBrowserImpl::UIT_LoadHTML(const std::wstring& html,
const std::wstring& url)
{
REQUIRE_UIT();
std::wstring urlString(url);
if (PathFileExists(url.c_str()) || PathIsUNC(url.c_str())) {
TCHAR fileURL[INTERNET_MAX_URL_LENGTH];
DWORD fileURLLength = sizeof(fileURL)/sizeof(fileURL[0]);
if (SUCCEEDED(UrlCreateFromPath(url.c_str(), fileURL, &fileURLLength, 0)))
urlString.assign(fileURL);
}
UIT_GetWebView()->GetMainFrame()->LoadHTMLString(
WideToUTF8(html), GURL(urlString));
}
void CefBrowserImpl::UIT_LoadHTMLForStreamRef(CefStreamReader* stream,
const std::wstring& url)
{
REQUIRE_UIT();
std::wstring urlString(url);
if (PathFileExists(url.c_str()) || PathIsUNC(url.c_str())) {
TCHAR fileURL[INTERNET_MAX_URL_LENGTH];
DWORD fileURLLength = sizeof(fileURL)/sizeof(fileURL[0]);
if (SUCCEEDED(UrlCreateFromPath(url.c_str(), fileURL, &fileURLLength, 0)))
urlString.assign(fileURL);
}
// read all of the stream data into a std::string.
std::stringstream ss;
char buff[BUFFER_SIZE];
size_t read;
do {
read = stream->Read(buff, sizeof(char), BUFFER_SIZE-1);
if(read > 0) {
buff[read] = 0;
ss << buff;
}
}
while(read > 0);
UIT_GetWebView()->GetMainFrame()->LoadHTMLString(ss.str(), GURL(urlString));
stream->Release();
}
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
{