Commit 603a502a authored by achuith@chromium.org's avatar achuith@chromium.org

Do not show downloads panel for temporary downloads.

BUG=106856
TEST=DownloadTest.DownloadUrlToFile should pass on ChromeOS.

Review URL: http://codereview.chromium.org/8929026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114691 0039d316-1c4b-4281-b951-d872f2087c98
parent 61b20c66
......@@ -1732,11 +1732,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToFile) {
ASSERT_TRUE(CheckDownloadFullPaths(browser(),
target_file_full_path,
OriginFile(file)));
#if !defined(OS_CHROMEOS)
// TODO(rdsmith/achuith): Re-enable on ChromeOS when
// http://crbug.com/106856 is fixed.
// Temporary downloads won't be visible.
CheckDownloadUI(browser(), false, false, file);
#endif
}
......@@ -3727,15 +3727,8 @@ void Browser::OnStartDownload(TabContents* source, DownloadItem* download) {
if (DisplayOldDownloadsUI()) {
#if defined(OS_CHROMEOS) && !defined(USE_AURA)
// Don't show content browser for extension/theme downloads from gallery.
ExtensionService* service = profile_->GetExtensionService();
if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) ||
service == NULL ||
!service->IsDownloadFromGallery(download->GetURL(),
download->GetReferrerUrl())) {
// Open the Active Downloads ui for chromeos.
if (ActiveDownloadsUI::ShouldShowPopup(profile_, download))
ActiveDownloadsUI::OpenPopup(profile_);
}
#else
// GetDownloadShelf creates the download shelf if it was not yet created.
DownloadShelf* shelf = window()->GetDownloadShelf();
......
......@@ -24,10 +24,12 @@
#include "base/values.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/media/media_player.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/download/download_service.h"
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/file_manager_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tabs/tab_strip_model.h"
......@@ -369,6 +371,19 @@ ActiveDownloadsUI::ActiveDownloadsUI(TabContents* contents)
CreateActiveDownloadsUIHTMLSource());
}
// static
bool ActiveDownloadsUI::ShouldShowPopup(Profile* profile,
DownloadItem* download) {
// Don't show downloads panel for extension/theme downloads from gallery,
// or temporary downloads.
ExtensionService* service = profile->GetExtensionService();
return !download->IsTemporary() &&
(!ChromeDownloadManagerDelegate::IsExtensionDownload(download) ||
service == NULL ||
!service->IsDownloadFromGallery(download->GetURL(),
download->GetReferrerUrl()));
}
// static
Browser* ActiveDownloadsUI::OpenPopup(Profile* profile) {
Browser* browser = GetPopup();
......@@ -397,6 +412,7 @@ Browser* ActiveDownloadsUI::OpenPopup(Profile* profile) {
return browser;
}
// static
Browser* ActiveDownloadsUI::GetPopup() {
for (BrowserList::const_iterator it = BrowserList::begin();
it != BrowserList::end();
......
......@@ -23,6 +23,7 @@ class ActiveDownloadsUI : public HtmlDialogUI {
public:
explicit ActiveDownloadsUI(TabContents* contents);
static bool ShouldShowPopup(Profile* profile, DownloadItem* download);
static Browser* OpenPopup(Profile* profile);
static Browser* GetPopup();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment