Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1417)

Unified Diff: chrome/browser/ui/browser.cc

Issue 7035015: Revert 85504 - Move download stuff to download tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/download/download_tab_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
===================================================================
--- chrome/browser/ui/browser.cc (revision 85514)
+++ chrome/browser/ui/browser.cc (working copy)
@@ -3299,6 +3299,51 @@
return window_->GetExtraRenderViewHeight();
}
+void Browser::OnStartDownload(DownloadItem* download, TabContents* tab) {
+ if (!window())
+ return;
+
+#if defined(OS_CHROMEOS)
+ // Don't show content browser for extension/theme downloads from gallery.
+ if (download->is_extension_install()) {
+ ExtensionService* service = profile_->GetExtensionService();
+ if (service && service->IsDownloadFromGallery(download->url(),
+ download->referrer_url())) {
+ return;
+ }
+ }
+ // Open the Active Downloads ui for chromeos.
+ ActiveDownloadsUI::OpenPopup(profile_);
+#else
+ // GetDownloadShelf creates the download shelf if it was not yet created.
+ window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download));
+
+ // Don't show the animation for "Save file" downloads.
+ if (download->total_bytes() <= 0)
+ return;
+
+ // For non-theme extensions, we don't show the download animation.
+ if (download->is_extension_install() &&
+ !ExtensionService::IsDownloadFromMiniGallery(download->url()))
+ return;
+
+ TabContents* current_tab = GetSelectedTabContents();
+ // We make this check for the case of minimized windows, unit tests, etc.
+ if (platform_util::IsVisible(current_tab->GetNativeView()) &&
+ ui::Animation::ShouldRenderRichAnimation()) {
+ DownloadStartedAnimation::Show(current_tab);
+ }
+#endif
+
+ // If the download occurs in a new tab, close it.
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(tab);
+ if (tab->controller().IsInitialNavigation() &&
+ GetConstrainingContentsWrapper(wrapper) == wrapper && tab_count() > 1) {
+ CloseContents(tab);
+ }
+}
+
void Browser::ShowPageInfo(Profile* profile,
const GURL& url,
const NavigationEntry::SSLStatus& ssl,
@@ -3438,56 +3483,6 @@
}
///////////////////////////////////////////////////////////////////////////////
-// Browser, DownloadTabHelperDelegate implementation:
-
-bool Browser::CanDownload(int request_id) {
- return true;
-}
-
-void Browser::OnStartDownload(DownloadItem* download, TabContentsWrapper* tab) {
- if (!window())
- return;
-
-#if defined(OS_CHROMEOS)
- // Don't show content browser for extension/theme downloads from gallery.
- if (download->is_extension_install()) {
- ExtensionService* service = profile_->GetExtensionService();
- if (service && service->IsDownloadFromGallery(download->url(),
- download->referrer_url())) {
- return;
- }
- }
- // Open the Active Downloads ui for chromeos.
- ActiveDownloadsUI::OpenPopup(profile_);
-#else
- // GetDownloadShelf creates the download shelf if it was not yet created.
- window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download));
-
- // Don't show the animation for "Save file" downloads.
- if (download->total_bytes() <= 0)
- return;
-
- // For non-theme extensions, we don't show the download animation.
- if (download->is_extension_install() &&
- !ExtensionService::IsDownloadFromMiniGallery(download->url()))
- return;
-
- TabContents* current_tab = GetSelectedTabContents();
- // We make this check for the case of minimized windows, unit tests, etc.
- if (platform_util::IsVisible(current_tab->GetNativeView()) &&
- ui::Animation::ShouldRenderRichAnimation()) {
- DownloadStartedAnimation::Show(current_tab);
- }
-#endif
-
- // If the download occurs in a new tab, close it.
- if (tab->tab_contents()->controller().IsInitialNavigation() &&
- GetConstrainingContentsWrapper(tab) == tab && tab_count() > 1) {
- CloseContents(tab->tab_contents());
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
// Browser, SelectFileDialog::Listener implementation:
void Browser::FileSelected(const FilePath& path, int index, void* params) {
@@ -4397,7 +4392,6 @@
// ...and all the helpers.
tab->blocked_content_tab_helper()->set_delegate(delegate);
tab->bookmark_tab_helper()->set_delegate(delegate);
- tab->download_tab_helper()->set_delegate(delegate);
tab->search_engine_tab_helper()->set_delegate(delegate);
}
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/download/download_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698