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 <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 3378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3389 if (download->is_extension_install()) { | 3389 if (download->is_extension_install()) { |
3390 ExtensionService* service = profile_->GetExtensionService(); | 3390 ExtensionService* service = profile_->GetExtensionService(); |
3391 if (service && service->IsDownloadFromGallery(download->GetURL(), | 3391 if (service && service->IsDownloadFromGallery(download->GetURL(), |
3392 download->referrer_url())) { | 3392 download->referrer_url())) { |
3393 return; | 3393 return; |
3394 } | 3394 } |
3395 } | 3395 } |
3396 // Open the Active Downloads ui for chromeos. | 3396 // Open the Active Downloads ui for chromeos. |
3397 ActiveDownloadsUI::OpenPopup(profile_); | 3397 ActiveDownloadsUI::OpenPopup(profile_); |
3398 #else | 3398 #else |
3399 // GetDownloadShelf creates the download shelf if it was not yet created. | 3399 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
3400 DownloadShelf* shelf = window()->GetDownloadShelf(); | 3400 switches::kDisableDownloadShelf)) { |
3401 shelf->AddDownload(new DownloadItemModel(download)); | 3401 // GetDownloadShelf creates the download shelf if it was not yet created. |
3402 DownloadShelf* shelf = window()->GetDownloadShelf(); | |
3403 shelf->AddDownload(new DownloadItemModel(download)); | |
3402 | 3404 |
3403 // Don't show the animation for "Save file" downloads. | 3405 // Don't show the animation for "Save file" downloads. |
ahendrickson
2011/08/09 19:19:28
Nit: the sense of this comment needs to be flipped
benjhayden
2011/08/09 19:30:51
Can you clarify? I thought I was careful to avoid
| |
3404 if (download->total_bytes() <= 0) | 3406 if (download->total_bytes() > 0) { |
3405 return; | 3407 // For non-theme extensions, we don't show the download animation. |
3408 if (!download->is_extension_install() || | |
3409 ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) { | |
3410 // Show animation in same window as the download shelf. Download shelf | |
3411 // may not be in the same window that initiated the download, e.g. | |
3412 // Panels. | |
3413 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); | |
3406 | 3414 |
3407 // For non-theme extensions, we don't show the download animation. | 3415 // We make this check for the case of minimized windows, unit tests, |
3408 if (download->is_extension_install() && | 3416 // etc. |
3409 !ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) | 3417 if (platform_util::IsVisible(shelf_tab->GetNativeView()) && |
3410 return; | 3418 ui::Animation::ShouldRenderRichAnimation()) { |
3411 | 3419 DownloadStartedAnimation::Show(shelf_tab); |
3412 // Show animation in same window as the download shelf. Download shelf | 3420 } |
3413 // may not be in the same window that initiated the download, e.g. Panels. | 3421 } |
3414 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); | 3422 } |
3415 | |
3416 // We make this check for the case of minimized windows, unit tests, etc. | |
3417 if (platform_util::IsVisible(shelf_tab->GetNativeView()) && | |
3418 ui::Animation::ShouldRenderRichAnimation()) { | |
3419 DownloadStartedAnimation::Show(shelf_tab); | |
3420 } | 3423 } |
3421 #endif | 3424 #endif |
3422 | 3425 |
3423 // If the download occurs in a new tab, close it. | 3426 // If the download occurs in a new tab, close it. |
3424 if (source->controller().IsInitialNavigation() && tab_count() > 1) | 3427 if (source->controller().IsInitialNavigation() && tab_count() > 1) |
3425 CloseContents(source); | 3428 CloseContents(source); |
3426 } | 3429 } |
3427 | 3430 |
3428 void Browser::ShowPageInfo(content::BrowserContext* browser_context, | 3431 void Browser::ShowPageInfo(content::BrowserContext* browser_context, |
3429 const GURL& url, | 3432 const GURL& url, |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4845 } | 4848 } |
4846 | 4849 |
4847 void Browser::ShowSyncSetup() { | 4850 void Browser::ShowSyncSetup() { |
4848 ProfileSyncService* service = | 4851 ProfileSyncService* service = |
4849 profile()->GetOriginalProfile()->GetProfileSyncService(); | 4852 profile()->GetOriginalProfile()->GetProfileSyncService(); |
4850 if (service->HasSyncSetupCompleted()) | 4853 if (service->HasSyncSetupCompleted()) |
4851 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4854 ShowOptionsTab(chrome::kSyncSetupSubPage); |
4852 else | 4855 else |
4853 service->ShowLoginDialog(); | 4856 service->ShowLoginDialog(); |
4854 } | 4857 } |
OLD | NEW |