base::BindOnce(callback, usage, user_data));
}
-void OnGetWebDBOrigins(Ewk_Web_Database_Origins_Get_Callback callback,
+void OnGetWebDBOrigins(storage::DatabaseQuotaClient* client,
+ Ewk_Web_Database_Origins_Get_Callback callback,
void* user_data,
- const std::set<GURL>& origins_ref) {
- Eina_List* origins = 0;
- for (std::set<GURL>::iterator iter = origins_ref.begin();
- iter != origins_ref.end(); ++iter) {
- _Ewk_Security_Origin* sec_origin = new _Ewk_Security_Origin(*iter);
- origins = eina_list_append(origins, sec_origin);
+ const std::vector<blink::StorageKey>& storage_keys) {
+ Eina_List* origin_list = nullptr;
+ for (const auto& key : storage_keys) {
+ _Ewk_Security_Origin* sec_origin =
+ new _Ewk_Security_Origin(key.origin().GetURL());
+ origin_list = eina_list_append(origin_list, sec_origin);
}
base::ThreadPool::PostTask(FROM_HERE, {BrowserThread::UI},
- base::BindOnce(callback, origins, user_data));
-}
-
-void GetWebDBOriginsOnDBThread(Ewk_Web_Database_Origins_Get_Callback callback,
- void* user_data,
- content::StoragePartition* partition) {
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
- storage::DatabaseQuotaClient client(partition->GetDatabaseTracker());
- client.GetOriginsForType(
- storage::kStorageTypeTemporary,
- base::BindOnce(&OnGetWebDBOrigins, callback, user_data));
-#endif
+ base::BindOnce(callback, origin_list, user_data));
}
-void OnGetFileSystemOrigins(Ewk_Local_File_System_Origins_Get_Callback callback,
- void* user_data,
- const std::set<GURL>& origins_ref) {
- Eina_List* origins = 0;
- for (std::set<GURL>::iterator iter = origins_ref.begin();
- iter != origins_ref.end(); ++iter) {
- _Ewk_Security_Origin* sec_origin = new _Ewk_Security_Origin(*iter);
- origins = eina_list_append(origins, sec_origin);
+void OnGetFileSystemOrigins(
+ storage::FileSystemQuotaClient* client,
+ Ewk_Local_File_System_Origins_Get_Callback callback,
+ void* user_data,
+ const std::vector<blink::StorageKey>& storage_keys) {
+ Eina_List* origin_list = nullptr;
+ for (const auto& key : storage_keys) {
+ _Ewk_Security_Origin* sec_origin =
+ new _Ewk_Security_Origin(key.origin().GetURL());
+ origin_list = eina_list_append(origin_list, sec_origin);
}
base::ThreadPool::PostTask(FROM_HERE, {BrowserThread::UI},
- base::BindOnce(callback, origins, user_data));
-}
-
-void GetFileSystemOriginsOnFILEThread(
- Ewk_Web_Database_Origins_Get_Callback callback,
- void* user_data,
- content::StoragePartition* partition) {
-#if !defined(EWK_BRINGUP) // FIXME: m76 bringup
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- std::unique_ptr<storage::FileSystemQuotaClient> client(
- new storage::FileSystemQuotaClient(partition->GetFileSystemContext(),
- false));
- client->GetOriginsForType(
- blink::mojom::StorageType::kTemporary,
- base::BindOnce(&OnGetFileSystemOrigins, callback, user_data));
-#endif
+ base::BindOnce(callback, origin_list, user_data));
}
} // namespace
void EWebContext::GetAllOriginsWithWebDB(
Ewk_Web_Database_Origins_Get_Callback callback,
void* user_data) {
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- content::StoragePartition* partition =
- BrowserContext::GetStoragePartition(browser_context_.get(), NULL);
- BrowserThread::ThreadPool::PostTask(
- BrowserThread::DB, FROM_HERE,
- base::BindOnce(&GetWebDBOriginsOnDBThread, callback, user_data,
- partition));
-#endif
+ auto* storage_partition = browser_context()->GetDefaultStoragePartition();
+ if (!storage_partition)
+ return;
+
+ auto client = std::make_unique<storage::DatabaseQuotaClient>(
+ *storage_partition->GetDatabaseTracker());
+ client->GetStorageKeysForType(
+ blink::mojom::StorageType::kTemporary,
+ base::BindOnce(&OnGetWebDBOrigins, base::Owned(std::move(client)),
+ callback, user_data));
}
void EWebContext::FileSystemDelete(const GURL& host) {
remover->RemoveImpl(BrowsingDataRemoverEfl::REMOVE_FILE_SYSTEMS, host);
}
-void EWebContext::GetAllOriginsWithFileSystem(
+bool EWebContext::GetAllOriginsWithFileSystem(
Ewk_Local_File_System_Origins_Get_Callback callback,
void* user_data) const {
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- content::StoragePartition* partition =
- BrowserContext::GetStoragePartition(browser_context_.get(), NULL);
- BrowserThread::ThreadPool::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::BindOnce(&GetFileSystemOriginsOnFILEThread, callback, user_data,
- partition));
-#endif
+ auto* storage_partition = browser_context()->GetDefaultStoragePartition();
+ if (!storage_partition) {
+ LOG(ERROR) << "Unable to get StoragePartition.";
+ return false;
+ }
+
+ auto* file_system_context = storage_partition->GetFileSystemContext();
+ if (!file_system_context) {
+ LOG(ERROR) << "Unable to get FileSystemContext.";
+ return false;
+ }
+
+ auto client =
+ std::make_unique<storage::FileSystemQuotaClient>(file_system_context);
+ client->GetStorageKeysForType(
+ blink::mojom::StorageType::kTemporary,
+ base::BindOnce(&OnGetFileSystemOrigins, base::Owned(std::move(client)),
+ callback, user_data));
+ return true;
}
bool EWebContext::SetFaviconDatabasePath(const base::FilePath& path) {
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/bind_post_task.h"
+#include "base/task/thread_pool.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/cookie_store_factory.h"
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-// This was added as part of M67 Brinup to avoid crash related to
-// CreateSQLitePersistentCookieStore.
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
if (file_storage == EWK_COOKIE_PERSISTENT_STORAGE_SQLITE)
CreateSQLitePersistentCookieStore(path, persist_session_cookies);
else
CreatePersistentCookieStore(path, persist_session_cookies);
-#else
- CreatePersistentCookieStore(path, persist_session_cookies);
-#endif
}
void URLRequestContextGetterEfl::CreateSQLitePersistentCookieStore(
if (base::DirectoryExists(path) || base::CreateDirectory(path)) {
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
persistent_store = new net::SQLitePersistentCookieStore(
- cookie_path,
- base::ThreadPool::CreateSingleThreadTaskRunner({BrowserThread::IO}),
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- BrowserThread::GetTaskRunnerForThread(BrowserThread::DB),
-#else
- base::ThreadPool::CreateSingleThreadTaskRunner({BrowserThread::UI}),
-#endif
- persist_session_cookies, NULL);
+ cookie_path, GetIOThreadTaskRunner({}),
+ base::ThreadPool::CreateSequencedTaskRunner(
+ {base::MayBlock(), net::GetCookieStoreBackgroundSequencePriority(),
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN}),
+ persist_session_cookies, nullptr);
} else {
NOTREACHED() << "The cookie storage directory could not be created";
return;