diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-01-26 15:39:10 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-03-12 13:27:21 +0000 |
commit | a984c64b0a17d62ca5cd866ad64bd0679a0cca96 (patch) | |
tree | 203e2470c5b651bf33f9d28f5b42854b3a1480a3 /src/core/download_manager_delegate_qt.cpp | |
parent | 2cf54e48922a7d379fb7e212966d05bc402e475d (diff) |
Clean up global profiles and ownership
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 <michael.bruning@theqtcompany.com>
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'src/core/download_manager_delegate_qt.cpp')
-rw-r--r-- | src/core/download_manager_delegate_qt.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
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<BrowserContextAdapterClient*> 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<BrowserContextAdapterClient*> 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); + } } } |