Merge revision 698 and 699 changes:
- Add persistent HTML5 application cache support (issue #543). - Standardize the approach for creating new directories. - Allow empty message parameters passed to CefJSDialogHandler. git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1025@700 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
748b664824
commit
f68c8439b6
|
@ -53,7 +53,7 @@ class CefJSDialogHandler : public virtual CefBase {
|
||||||
// Called to run a JavaScript alert message. Return false to display the
|
// Called to run a JavaScript alert message. Return false to display the
|
||||||
// default alert or true if you displayed a custom alert.
|
// default alert or true if you displayed a custom alert.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef(optional_param=message)--*/
|
||||||
virtual bool OnJSAlert(CefRefPtr<CefBrowser> browser,
|
virtual bool OnJSAlert(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& message) { return false; }
|
const CefString& message) { return false; }
|
||||||
|
@ -63,7 +63,7 @@ class CefJSDialogHandler : public virtual CefBase {
|
||||||
// default alert or true if you displayed a custom alert. If you handled the
|
// default alert or true if you displayed a custom alert. If you handled the
|
||||||
// alert set |retval| to true if the user accepted the confirmation.
|
// alert set |retval| to true if the user accepted the confirmation.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef(optional_param=message)--*/
|
||||||
virtual bool OnJSConfirm(CefRefPtr<CefBrowser> browser,
|
virtual bool OnJSConfirm(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& message,
|
const CefString& message,
|
||||||
|
@ -75,7 +75,7 @@ class CefJSDialogHandler : public virtual CefBase {
|
||||||
// the prompt set |retval| to true if the user accepted the prompt and request
|
// the prompt set |retval| to true if the user accepted the prompt and request
|
||||||
// and |result| to the resulting value.
|
// and |result| to the resulting value.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef(optional_param=message,optional_param=defaultValue)--*/
|
||||||
virtual bool OnJSPrompt(CefRefPtr<CefBrowser> browser,
|
virtual bool OnJSPrompt(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& message,
|
const CefString& message,
|
||||||
|
|
|
@ -147,15 +147,6 @@ void BrowserRequestContext::Init(
|
||||||
const FilePath& cache_path,
|
const FilePath& cache_path,
|
||||||
net::HttpCache::Mode cache_mode,
|
net::HttpCache::Mode cache_mode,
|
||||||
bool no_proxy) {
|
bool no_proxy) {
|
||||||
// Create the |cache_path| directory if necessary.
|
|
||||||
bool cache_path_valid = false;
|
|
||||||
if (!cache_path.empty()) {
|
|
||||||
if (file_util::CreateDirectory(cache_path))
|
|
||||||
cache_path_valid = true;
|
|
||||||
else
|
|
||||||
NOTREACHED() << "The cache_path directory could not be created";
|
|
||||||
}
|
|
||||||
|
|
||||||
SetCookieStoragePath(cache_path);
|
SetCookieStoragePath(cache_path);
|
||||||
|
|
||||||
storage_.set_origin_bound_cert_service(new net::OriginBoundCertService(
|
storage_.set_origin_bound_cert_service(new net::OriginBoundCertService(
|
||||||
|
@ -238,7 +229,7 @@ void BrowserRequestContext::Init(
|
||||||
storage_.set_http_server_properties(new net::HttpServerPropertiesImpl);
|
storage_.set_http_server_properties(new net::HttpServerPropertiesImpl);
|
||||||
|
|
||||||
net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend(
|
net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend(
|
||||||
cache_path_valid ? net::DISK_CACHE : net::MEMORY_CACHE,
|
cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE,
|
||||||
cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread());
|
cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread());
|
||||||
|
|
||||||
net::HttpCache* cache =
|
net::HttpCache* cache =
|
||||||
|
@ -307,13 +298,17 @@ void BrowserRequestContext::SetCookieStoragePath(const FilePath& path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath new_path = path;
|
||||||
|
|
||||||
scoped_refptr<BrowserPersistentCookieStore> persistent_store;
|
scoped_refptr<BrowserPersistentCookieStore> persistent_store;
|
||||||
if (!path.empty()) {
|
if (!new_path.empty()) {
|
||||||
if (file_util::CreateDirectory(path)) {
|
if (!file_util::PathExists(new_path) &&
|
||||||
const FilePath& cookie_path = path.AppendASCII("Cookies");
|
!file_util::CreateDirectory(new_path)) {
|
||||||
persistent_store = new BrowserPersistentCookieStore(cookie_path, false);
|
NOTREACHED() << "Failed to create cookie storage directory";
|
||||||
|
new_path.clear();
|
||||||
} else {
|
} else {
|
||||||
NOTREACHED() << "The cookie storage directory could not be created";
|
FilePath cookie_path = new_path.Append(FILE_PATH_LITERAL("Cookies"));
|
||||||
|
persistent_store = new BrowserPersistentCookieStore(cookie_path, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +317,7 @@ void BrowserRequestContext::SetCookieStoragePath(const FilePath& path) {
|
||||||
// longer referenced.
|
// longer referenced.
|
||||||
storage_.set_cookie_store(
|
storage_.set_cookie_store(
|
||||||
new net::CookieMonster(persistent_store.get(), NULL));
|
new net::CookieMonster(persistent_store.get(), NULL));
|
||||||
cookie_store_path_ = path;
|
cookie_store_path_ = new_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& BrowserRequestContext::GetUserAgent(
|
const std::string& BrowserRequestContext::GetUserAgent(
|
||||||
|
|
|
@ -53,16 +53,17 @@ BrowserWebKitInit::BrowserWebKitInit()
|
||||||
PathService::Get(base::DIR_MODULE, &module_path) &&
|
PathService::Get(base::DIR_MODULE, &module_path) &&
|
||||||
media::InitializeMediaLibrary(module_path));
|
media::InitializeMediaLibrary(module_path));
|
||||||
|
|
||||||
// Construct and initialize an appcache system for this scope.
|
FilePath appcache_path;
|
||||||
// A new empty temp directory is created to house any cached
|
FilePath cache_path = _Context->cache_path();
|
||||||
// content during the run. Upon exit that directory is deleted.
|
if (!cache_path.empty()) {
|
||||||
// If we can't create a tempdir, we'll use in-memory storage.
|
appcache_path = cache_path.Append(FILE_PATH_LITERAL("AppCache"));
|
||||||
if (!appcache_dir_.CreateUniqueTempDir()) {
|
if (!file_util::PathExists(appcache_path) &&
|
||||||
LOG(WARNING) << "Failed to create a temp dir for the appcache, "
|
!file_util::CreateDirectory(appcache_path)) {
|
||||||
"using in-memory storage.";
|
LOG(WARNING) << "Failed to create appcache storage directory";
|
||||||
DCHECK(appcache_dir_.path().empty());
|
appcache_path.clear();
|
||||||
}
|
}
|
||||||
BrowserAppCacheSystem::InitializeOnUIThread(appcache_dir_.path());
|
}
|
||||||
|
BrowserAppCacheSystem::InitializeOnUIThread(appcache_path);
|
||||||
|
|
||||||
WebKit::WebDatabase::setObserver(&database_system_);
|
WebKit::WebDatabase::setObserver(&database_system_);
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl {
|
||||||
webkit_glue::WebClipboardImpl clipboard_;
|
webkit_glue::WebClipboardImpl clipboard_;
|
||||||
SimpleClipboardClient clipboard_client_;
|
SimpleClipboardClient clipboard_client_;
|
||||||
webkit_glue::WebFileUtilitiesImpl file_utilities_;
|
webkit_glue::WebFileUtilitiesImpl file_utilities_;
|
||||||
ScopedTempDir appcache_dir_;
|
|
||||||
BrowserAppCacheSystem appcache_system_;
|
BrowserAppCacheSystem appcache_system_;
|
||||||
BrowserDatabaseSystem database_system_;
|
BrowserDatabaseSystem database_system_;
|
||||||
BrowserWebCookieJarImpl cookie_jar_;
|
BrowserWebCookieJarImpl cookie_jar_;
|
||||||
|
|
|
@ -172,6 +172,12 @@ bool CefContext::Initialize(const CefSettings& settings,
|
||||||
application_ = application;
|
application_ = application;
|
||||||
|
|
||||||
cache_path_ = FilePath(CefString(&settings.cache_path));
|
cache_path_ = FilePath(CefString(&settings.cache_path));
|
||||||
|
if (!cache_path_.empty() &&
|
||||||
|
!file_util::PathExists(cache_path_) &&
|
||||||
|
!file_util::CreateDirectory(cache_path_)) {
|
||||||
|
NOTREACHED() << "Failed to create cache_path directory";
|
||||||
|
cache_path_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||||
// We want to be sure to init NSPR on the main thread.
|
// We want to be sure to init NSPR on the main thread.
|
||||||
|
|
|
@ -227,12 +227,13 @@ bool CefCookieManagerImpl::SetStoragePath(const CefString& path) {
|
||||||
|
|
||||||
scoped_refptr<BrowserPersistentCookieStore> persistent_store;
|
scoped_refptr<BrowserPersistentCookieStore> persistent_store;
|
||||||
if (!new_path.empty()) {
|
if (!new_path.empty()) {
|
||||||
if (file_util::CreateDirectory(new_path)) {
|
if (!file_util::PathExists(new_path) &&
|
||||||
const FilePath& cookie_path = new_path.AppendASCII("Cookies");
|
!file_util::CreateDirectory(new_path)) {
|
||||||
persistent_store = new BrowserPersistentCookieStore(cookie_path, false);
|
NOTREACHED() << "Failed to create cookie storage directory";
|
||||||
|
new_path.clear();
|
||||||
} else {
|
} else {
|
||||||
NOTREACHED() << "The cookie storage directory could not be created";
|
FilePath cookie_path = new_path.Append(FILE_PATH_LITERAL("Cookies"));
|
||||||
storage_path_.clear();
|
persistent_store = new BrowserPersistentCookieStore(cookie_path, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,7 @@ int CEF_CALLBACK jsdialog_handler_on_jsalert(
|
||||||
DCHECK(frame);
|
DCHECK(frame);
|
||||||
if (!frame)
|
if (!frame)
|
||||||
return 0;
|
return 0;
|
||||||
// Verify param: message; type: string_byref_const
|
// Unverified params: message
|
||||||
DCHECK(message);
|
|
||||||
if (!message)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSAlert(
|
bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSAlert(
|
||||||
|
@ -64,14 +61,11 @@ int CEF_CALLBACK jsdialog_handler_on_jsconfirm(
|
||||||
DCHECK(frame);
|
DCHECK(frame);
|
||||||
if (!frame)
|
if (!frame)
|
||||||
return 0;
|
return 0;
|
||||||
// Verify param: message; type: string_byref_const
|
|
||||||
DCHECK(message);
|
|
||||||
if (!message)
|
|
||||||
return 0;
|
|
||||||
// Verify param: retval; type: bool_byref
|
// Verify param: retval; type: bool_byref
|
||||||
DCHECK(retval);
|
DCHECK(retval);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
return 0;
|
return 0;
|
||||||
|
// Unverified params: message
|
||||||
|
|
||||||
// Translate param: retval; type: bool_byref
|
// Translate param: retval; type: bool_byref
|
||||||
bool retvalBool = (retval && *retval)?true:false;
|
bool retvalBool = (retval && *retval)?true:false;
|
||||||
|
@ -108,14 +102,6 @@ int CEF_CALLBACK jsdialog_handler_on_jsprompt(
|
||||||
DCHECK(frame);
|
DCHECK(frame);
|
||||||
if (!frame)
|
if (!frame)
|
||||||
return 0;
|
return 0;
|
||||||
// Verify param: message; type: string_byref_const
|
|
||||||
DCHECK(message);
|
|
||||||
if (!message)
|
|
||||||
return 0;
|
|
||||||
// Verify param: defaultValue; type: string_byref_const
|
|
||||||
DCHECK(defaultValue);
|
|
||||||
if (!defaultValue)
|
|
||||||
return 0;
|
|
||||||
// Verify param: retval; type: bool_byref
|
// Verify param: retval; type: bool_byref
|
||||||
DCHECK(retval);
|
DCHECK(retval);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
|
@ -124,6 +110,7 @@ int CEF_CALLBACK jsdialog_handler_on_jsprompt(
|
||||||
DCHECK(result);
|
DCHECK(result);
|
||||||
if (!result)
|
if (!result)
|
||||||
return 0;
|
return 0;
|
||||||
|
// Unverified params: message, defaultValue
|
||||||
|
|
||||||
// Translate param: retval; type: bool_byref
|
// Translate param: retval; type: bool_byref
|
||||||
bool retvalBool = (retval && *retval)?true:false;
|
bool retvalBool = (retval && *retval)?true:false;
|
||||||
|
|
|
@ -32,10 +32,7 @@ bool CefJSDialogHandlerCToCpp::OnJSAlert(CefRefPtr<CefBrowser> browser,
|
||||||
DCHECK(frame.get());
|
DCHECK(frame.get());
|
||||||
if (!frame.get())
|
if (!frame.get())
|
||||||
return false;
|
return false;
|
||||||
// Verify param: message; type: string_byref_const
|
// Unverified params: message
|
||||||
DCHECK(!message.empty());
|
|
||||||
if (message.empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
int _retval = struct_->on_jsalert(struct_,
|
int _retval = struct_->on_jsalert(struct_,
|
||||||
|
@ -62,10 +59,7 @@ bool CefJSDialogHandlerCToCpp::OnJSConfirm(CefRefPtr<CefBrowser> browser,
|
||||||
DCHECK(frame.get());
|
DCHECK(frame.get());
|
||||||
if (!frame.get())
|
if (!frame.get())
|
||||||
return false;
|
return false;
|
||||||
// Verify param: message; type: string_byref_const
|
// Unverified params: message
|
||||||
DCHECK(!message.empty());
|
|
||||||
if (message.empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Translate param: retval; type: bool_byref
|
// Translate param: retval; type: bool_byref
|
||||||
int retvalInt = retval;
|
int retvalInt = retval;
|
||||||
|
@ -100,14 +94,7 @@ bool CefJSDialogHandlerCToCpp::OnJSPrompt(CefRefPtr<CefBrowser> browser,
|
||||||
DCHECK(frame.get());
|
DCHECK(frame.get());
|
||||||
if (!frame.get())
|
if (!frame.get())
|
||||||
return false;
|
return false;
|
||||||
// Verify param: message; type: string_byref_const
|
// Unverified params: message, defaultValue
|
||||||
DCHECK(!message.empty());
|
|
||||||
if (message.empty())
|
|
||||||
return false;
|
|
||||||
// Verify param: defaultValue; type: string_byref_const
|
|
||||||
DCHECK(!defaultValue.empty());
|
|
||||||
if (defaultValue.empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Translate param: retval; type: bool_byref
|
// Translate param: retval; type: bool_byref
|
||||||
int retvalInt = retval;
|
int retvalInt = retval;
|
||||||
|
|
Loading…
Reference in New Issue