| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3447 } | 3447 } |
| 3448 | 3448 |
| 3449 void Browser::OnStartDownload(DownloadItem* download, TabContentsWrapper* tab) { | 3449 void Browser::OnStartDownload(DownloadItem* download, TabContentsWrapper* tab) { |
| 3450 if (!window()) | 3450 if (!window()) |
| 3451 return; | 3451 return; |
| 3452 | 3452 |
| 3453 #if defined(OS_CHROMEOS) | 3453 #if defined(OS_CHROMEOS) |
| 3454 // Don't show content browser for extension/theme downloads from gallery. | 3454 // Don't show content browser for extension/theme downloads from gallery. |
| 3455 if (download->is_extension_install()) { | 3455 if (download->is_extension_install()) { |
| 3456 ExtensionService* service = profile_->GetExtensionService(); | 3456 ExtensionService* service = profile_->GetExtensionService(); |
| 3457 if (service && service->IsDownloadFromGallery(download->url(), | 3457 if (service && service->IsDownloadFromGallery(download->GetURL(), |
| 3458 download->referrer_url())) { | 3458 download->referrer_url())) { |
| 3459 return; | 3459 return; |
| 3460 } | 3460 } |
| 3461 } | 3461 } |
| 3462 // Open the Active Downloads ui for chromeos. | 3462 // Open the Active Downloads ui for chromeos. |
| 3463 ActiveDownloadsUI::OpenPopup(profile_); | 3463 ActiveDownloadsUI::OpenPopup(profile_); |
| 3464 #else | 3464 #else |
| 3465 // GetDownloadShelf creates the download shelf if it was not yet created. | 3465 // GetDownloadShelf creates the download shelf if it was not yet created. |
| 3466 window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download)); | 3466 window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download)); |
| 3467 | 3467 |
| 3468 // Don't show the animation for "Save file" downloads. | 3468 // Don't show the animation for "Save file" downloads. |
| 3469 if (download->total_bytes() <= 0) | 3469 if (download->total_bytes() <= 0) |
| 3470 return; | 3470 return; |
| 3471 | 3471 |
| 3472 // For non-theme extensions, we don't show the download animation. | 3472 // For non-theme extensions, we don't show the download animation. |
| 3473 if (download->is_extension_install() && | 3473 if (download->is_extension_install() && |
| 3474 !ExtensionService::IsDownloadFromMiniGallery(download->url())) | 3474 !ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) |
| 3475 return; | 3475 return; |
| 3476 | 3476 |
| 3477 TabContents* current_tab = GetSelectedTabContents(); | 3477 TabContents* current_tab = GetSelectedTabContents(); |
| 3478 // We make this check for the case of minimized windows, unit tests, etc. | 3478 // We make this check for the case of minimized windows, unit tests, etc. |
| 3479 if (platform_util::IsVisible(current_tab->GetNativeView()) && | 3479 if (platform_util::IsVisible(current_tab->GetNativeView()) && |
| 3480 ui::Animation::ShouldRenderRichAnimation()) { | 3480 ui::Animation::ShouldRenderRichAnimation()) { |
| 3481 DownloadStartedAnimation::Show(current_tab); | 3481 DownloadStartedAnimation::Show(current_tab); |
| 3482 } | 3482 } |
| 3483 #endif | 3483 #endif |
| 3484 | 3484 |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4619 TabContents* current_tab = GetSelectedTabContents(); | 4619 TabContents* current_tab = GetSelectedTabContents(); |
| 4620 if (current_tab) { | 4620 if (current_tab) { |
| 4621 content_restrictions = current_tab->content_restrictions(); | 4621 content_restrictions = current_tab->content_restrictions(); |
| 4622 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4622 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
| 4623 // See comment in UpdateCommandsForTabState about why we call url(). | 4623 // See comment in UpdateCommandsForTabState about why we call url(). |
| 4624 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4624 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
| 4625 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4625 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
| 4626 } | 4626 } |
| 4627 return content_restrictions; | 4627 return content_restrictions; |
| 4628 } | 4628 } |
| OLD | NEW |