From a984c64b0a17d62ca5cd866ad64bd0679a0cca96 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 26 Jan 2015 15:39:10 +0100 Subject: Clean up global profiles and ownership MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes the unused global off-the-record browser-contexts and changes all browser-contexts to be ref-counted by an API level profile. The API default profiles are now owned by a global QObject and are deleted on exit. Change-Id: Id7c9eafa24829118105f58b66663a6348216823d Reviewed-by: Michael BrĂ¼ning Reviewed-by: Andras Becsi --- src/core/download_manager_delegate_qt.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/core/download_manager_delegate_qt.cpp') diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index e84ca5f2c..c01dcf63d 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -127,7 +127,8 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i } item->AddObserver(this); - if (m_contextAdapter->client()) { + QList clients = m_contextAdapter->clients(); + if (!clients.isEmpty()) { BrowserContextAdapterClient::DownloadItemInfo info = { item->GetId(), toQt(item->GetURL()), @@ -137,7 +138,12 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i suggestedFilePath, false /* accepted */ }; - m_contextAdapter->client()->downloadRequested(info); + + Q_FOREACH (BrowserContextAdapterClient *client, clients) { + client->downloadRequested(info); + if (info.accepted) + break; + } suggestedFile.setFile(info.path); @@ -173,7 +179,8 @@ void DownloadManagerDelegateQt::GetSaveDir(content::BrowserContext* browser_cont void DownloadManagerDelegateQt::OnDownloadUpdated(content::DownloadItem *download) { - if (m_contextAdapter->client()) { + QList clients = m_contextAdapter->clients(); + if (!clients.isEmpty()) { BrowserContextAdapterClient::DownloadItemInfo info = { download->GetId(), toQt(download->GetURL()), @@ -183,7 +190,10 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(content::DownloadItem *downloa QString(), true /* accepted */ }; - m_contextAdapter->client()->downloadUpdated(info); + + Q_FOREACH (BrowserContextAdapterClient *client, clients) { + client->downloadUpdated(info); + } } } -- cgit v1.2.3