mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for JavaScript alert, confirm, prompt and onbeforeunload dialogs (issue #507).
- Add CefJSDialogHandler and CefJSDialogCallback interfaces. - Add default dialog implementations for Windows and Mac OS-X. - Add "JavaScript Dialogs" example to cefclient. - Change TestHandler::AddResource to ignore the query component when matching URLs. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@594 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -56,7 +56,14 @@ CefRefPtr<CefResourceHandler> TestHandler::GetResourceHandler(
|
||||
|
||||
if (resource_map_.size() > 0) {
|
||||
CefString url = request->GetURL();
|
||||
ResourceMap::const_iterator it = resource_map_.find(url);
|
||||
|
||||
// Ignore the query component, if any.
|
||||
std::string urlStr = url;
|
||||
int idx = urlStr.find('?');
|
||||
if (idx > 0)
|
||||
urlStr = urlStr.substr(0, idx);
|
||||
|
||||
ResourceMap::const_iterator it = resource_map_.find(urlStr);
|
||||
if (it != resource_map_.end()) {
|
||||
// Return the previously mapped resource
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
@@ -97,10 +104,17 @@ void TestHandler::CreateBrowser(const CefString& url) {
|
||||
CefBrowserHost::CreateBrowser(windowInfo, this, url, settings);
|
||||
}
|
||||
|
||||
void TestHandler::AddResource(const CefString& url,
|
||||
void TestHandler::AddResource(const std::string& url,
|
||||
const std::string& content,
|
||||
const CefString& mimeType) {
|
||||
resource_map_.insert(std::make_pair(url, std::make_pair(content, mimeType)));
|
||||
const std::string& mimeType) {
|
||||
// Ignore the query component, if any.
|
||||
std::string urlStr = url;
|
||||
int idx = urlStr.find('?');
|
||||
if (idx > 0)
|
||||
urlStr = urlStr.substr(0, idx);
|
||||
|
||||
resource_map_.insert(
|
||||
std::make_pair(urlStr, std::make_pair(content, mimeType)));
|
||||
}
|
||||
|
||||
void TestHandler::ClearResources() {
|
||||
|
Reference in New Issue
Block a user