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:
Marshall Greenblatt
2012-06-20 19:46:23 +00:00
parent 748b664824
commit f68c8439b6
8 changed files with 42 additions and 66 deletions

View File

@@ -147,15 +147,6 @@ void BrowserRequestContext::Init(
const FilePath& cache_path,
net::HttpCache::Mode cache_mode,
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);
storage_.set_origin_bound_cert_service(new net::OriginBoundCertService(
@@ -238,7 +229,7 @@ void BrowserRequestContext::Init(
storage_.set_http_server_properties(new net::HttpServerPropertiesImpl);
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());
net::HttpCache* cache =
@@ -307,13 +298,17 @@ void BrowserRequestContext::SetCookieStoragePath(const FilePath& path) {
return;
}
FilePath new_path = path;
scoped_refptr<BrowserPersistentCookieStore> persistent_store;
if (!path.empty()) {
if (file_util::CreateDirectory(path)) {
const FilePath& cookie_path = path.AppendASCII("Cookies");
persistent_store = new BrowserPersistentCookieStore(cookie_path, false);
if (!new_path.empty()) {
if (!file_util::PathExists(new_path) &&
!file_util::CreateDirectory(new_path)) {
NOTREACHED() << "Failed to create cookie storage directory";
new_path.clear();
} 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.
storage_.set_cookie_store(
new net::CookieMonster(persistent_store.get(), NULL));
cookie_store_path_ = path;
cookie_store_path_ = new_path;
}
const std::string& BrowserRequestContext::GetUserAgent(