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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 7605003: --downloads-new-ui completely disables the download shelf. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: extract_actions Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 if (download->is_extension_install()) { 3384 if (download->is_extension_install()) {
3385 ExtensionService* service = profile_->GetExtensionService(); 3385 ExtensionService* service = profile_->GetExtensionService();
3386 if (service && service->IsDownloadFromGallery(download->GetURL(), 3386 if (service && service->IsDownloadFromGallery(download->GetURL(),
3387 download->referrer_url())) { 3387 download->referrer_url())) {
3388 return; 3388 return;
3389 } 3389 }
3390 } 3390 }
3391 // Open the Active Downloads ui for chromeos. 3391 // Open the Active Downloads ui for chromeos.
3392 ActiveDownloadsUI::OpenPopup(profile_); 3392 ActiveDownloadsUI::OpenPopup(profile_);
3393 #else 3393 #else
3394 // GetDownloadShelf creates the download shelf if it was not yet created. 3394 if (!CommandLine::ForCurrentProcess()->HasSwitch(
3395 DownloadShelf* shelf = window()->GetDownloadShelf(); 3395 switches::kDisableDownloadShelf)) {
3396 shelf->AddDownload(new DownloadItemModel(download)); 3396 // GetDownloadShelf creates the download shelf if it was not yet created.
3397 DownloadShelf* shelf = window()->GetDownloadShelf();
3398 shelf->AddDownload(new DownloadItemModel(download));
3397 3399
3398 // Don't show the animation for "Save file" downloads. 3400 // Don't show the animation for "Save file" downloads.
3399 if (download->total_bytes() <= 0) 3401 if (download->total_bytes() > 0) {
cbentzel 2011/08/10 11:54:54 This is different behavior from before - now the t
benjhayden 2011/08/10 17:09:17 Right, that's the bug fix part of this CL. It seem
3400 return; 3402 // For non-theme extensions, we don't show the download animation.
3403 if (!download->is_extension_install() ||
3404 ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) {
cbentzel 2011/08/10 11:54:54 Same concern here.
benjhayden 2011/08/10 17:09:17 Same answer.
3405 // Show animation in same window as the download shelf. Download shelf
3406 // may not be in the same window that initiated the download, e.g.
3407 // Panels.
3408 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents();
3401 3409
3402 // For non-theme extensions, we don't show the download animation. 3410 // We make this check for the case of minimized windows, unit tests,
3403 if (download->is_extension_install() && 3411 // etc.
3404 !ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) 3412 if (platform_util::IsVisible(shelf_tab->GetNativeView()) &&
3405 return; 3413 ui::Animation::ShouldRenderRichAnimation()) {
3406 3414 DownloadStartedAnimation::Show(shelf_tab);
3407 // Show animation in same window as the download shelf. Download shelf 3415 }
3408 // may not be in the same window that initiated the download, e.g. Panels. 3416 }
3409 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); 3417 }
3410
3411 // We make this check for the case of minimized windows, unit tests, etc.
3412 if (platform_util::IsVisible(shelf_tab->GetNativeView()) &&
3413 ui::Animation::ShouldRenderRichAnimation()) {
3414 DownloadStartedAnimation::Show(shelf_tab);
3415 } 3418 }
3416 #endif 3419 #endif
3417 3420
3418 // If the download occurs in a new tab, close it. 3421 // If the download occurs in a new tab, close it.
3419 if (source->controller().IsInitialNavigation() && tab_count() > 1) 3422 if (source->controller().IsInitialNavigation() && tab_count() > 1)
3420 CloseContents(source); 3423 CloseContents(source);
3421 } 3424 }
3422 3425
3423 void Browser::ShowPageInfo(content::BrowserContext* browser_context, 3426 void Browser::ShowPageInfo(content::BrowserContext* browser_context,
3424 const GURL& url, 3427 const GURL& url,
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
4840 } 4843 }
4841 4844
4842 void Browser::ShowSyncSetup() { 4845 void Browser::ShowSyncSetup() {
4843 ProfileSyncService* service = 4846 ProfileSyncService* service =
4844 profile()->GetOriginalProfile()->GetProfileSyncService(); 4847 profile()->GetOriginalProfile()->GetProfileSyncService();
4845 if (service->HasSyncSetupCompleted()) 4848 if (service->HasSyncSetupCompleted())
4846 ShowOptionsTab(chrome::kSyncSetupSubPage); 4849 ShowOptionsTab(chrome::kSyncSetupSubPage);
4847 else 4850 else
4848 service->ShowLoginDialog(); 4851 service->ShowLoginDialog();
4849 } 4852 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698