- Eliminate use of scoped directories (issue #670).

- Create a temporary cache_path directory if none is specified (issue #735).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@827 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-10-01 21:49:08 +00:00
parent 7a0ff637f0
commit 49640d17a3
8 changed files with 28 additions and 40 deletions

View File

@ -4,6 +4,7 @@
#include "libcef/browser_file_system.h"
#include "libcef/browser_file_writer.h"
#include "libcef/cef_context.h"
#include "libcef/cef_thread.h"
#include "base/bind.h"
@ -80,25 +81,20 @@ BrowserFileSystem::BrowserFileSystem() {
void BrowserFileSystem::CreateContext() {
if (file_system_context_.get())
return;
if (file_system_dir_.CreateUniqueTempDir()) {
std::vector<std::string> additional_allowed_schemes;
additional_allowed_schemes.push_back("file");
std::vector<std::string> additional_allowed_schemes;
additional_allowed_schemes.push_back("file");
file_system_context_ = new FileSystemContext(
make_scoped_ptr(new FileSystemTaskRunners(
CefThread::GetMessageLoopProxyForThread(CefThread::IO),
CefThread::GetMessageLoopProxyForThread(CefThread::FILE),
CefThread::GetMessageLoopProxyForThread(CefThread::FILE))),
NULL /* special storage policy */,
NULL /* quota manager */,
file_system_dir_.path(),
fileapi::FileSystemOptions(
fileapi::FileSystemOptions::PROFILE_MODE_NORMAL,
additional_allowed_schemes));
} else {
LOG(WARNING) << "Failed to create a temp dir for the filesystem."
"FileSystem feature will be disabled.";
}
file_system_context_ = new FileSystemContext(
make_scoped_ptr(new FileSystemTaskRunners(
CefThread::GetMessageLoopProxyForThread(CefThread::IO),
CefThread::GetMessageLoopProxyForThread(CefThread::FILE),
CefThread::GetMessageLoopProxyForThread(CefThread::FILE))),
NULL /* special storage policy */,
NULL /* quota manager */,
_Context->cache_path(),
fileapi::FileSystemOptions(
fileapi::FileSystemOptions::PROFILE_MODE_NORMAL,
additional_allowed_schemes));
}
BrowserFileSystem::~BrowserFileSystem() {