Merge pull request #4071 from deepak1556/session_flush_data_patch

session: api to flush DOMStorage data
This commit is contained in:
Cheng Zhao 2016-01-13 16:18:37 +08:00
Родитель 884a8a753f 8433d94cac
Коммит 489539d62e
3 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -312,6 +312,12 @@ void Session::ClearStorageData(mate::Arguments* args) {
base::Time(), base::Time::Max(), callback);
}
void Session::FlushStorageData() {
auto storage_partition =
content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
storage_partition->Flush();
}
void Session::SetProxy(const net::ProxyConfig& config,
const base::Closure& callback) {
auto getter = browser_context_->GetRequestContext();
@ -416,6 +422,7 @@ void Session::BuildPrototype(v8::Isolate* isolate,
.SetMethod("resolveProxy", &Session::ResolveProxy)
.SetMethod("clearCache", &Session::ClearCache)
.SetMethod("clearStorageData", &Session::ClearStorageData)
.SetMethod("flushStorageData", &Session::FlushStorageData)
.SetMethod("setProxy", &Session::SetProxy)
.SetMethod("setDownloadPath", &Session::SetDownloadPath)
.SetMethod("enableNetworkEmulation", &Session::EnableNetworkEmulation)

Просмотреть файл

@ -64,6 +64,7 @@ class Session: public mate::TrackableObject<Session>,
void ResolveProxy(const GURL& url, ResolveProxyCallback callback);
void ClearCache(const net::CompletionCallback& callback);
void ClearStorageData(mate::Arguments* args);
void FlushStorageData();
void SetProxy(const net::ProxyConfig& config, const base::Closure& callback);
void SetDownloadPath(const base::FilePath& path);
void EnableNetworkEmulation(const mate::Dictionary& options);

Просмотреть файл

@ -179,6 +179,10 @@ Clears the sessions HTTP cache.
Clears the data of web storages.
#### `ses.flushStorageData()`
Writes any unwritten DOMStorage data to disk.
#### `ses.setProxy(config, callback)`
* `config` Object